PdfDocument Example

The following example dynamically creates a PDF document based on an HTML document where the body consists of the output of the Lorem macro.

Various header and footer settings are applied and the document is secured with a password. The password implies that a user has to supply a password before being able to view the contents of the PDF document.

The PdfDocument macro is set in streaming mode which is the most efficient mode in terms of performance.

Smartsite SXML CopyCode image Copy Code
<se:pdfdocument streaming="true">
        <se:parameter name="html">
                    <se:lorem unitcount="5" unittype="paragraph" />
        <se:parameter name="pdfsettings">
            <pdf:pdfsettings xmlns:pdf="http://smartsite.nl/namespaces/pdf/1.0" >
                <!-- general PDF settings -->
                    pdfpageorientation="landscape" />
                <!-- header settings -->
                    headertext="Lorem Ipsum" />
                <!-- footer settings -->
                    showpagenumber="true" />
                <!-- protects the document using a password -->
                    userpassword="lorem" />