Creating PDF documents

Release 1.0 - ...

Smartsite can create PDF by simply requesting content item or page with a 'trigger' in the querystring that has the following syntax: hid=pdf. This trigger can also contain a number of commands for manipulating the PDF output formatting. These commands are separated by a ; character. Parameters are not required to create PDF. Simply defining the trigger in a querystring is enough.

All PDFCreator commands are defined in a configuration file, Smartsite.Pdf.Config.
This file consists of two sections:

  • Global PDF settings
  • Commands and parameters, the definition of all PDF commands

Global application settings

Smartsite.Pdf.config contains a "smartsite.pdf" node. The attributes stored in this node apply to the PDF component in general. We advise caution when changing the values of these items. Below an explanation of what these settings do.

Setting Definition Default
enabled Enables or disables the entire image processor

true

cachemode Defines the disk cache mode (values: None, Read, Write, ReadWrite) ReadWrite
headerresponsemessage A message sent using HTTP headers for every output of the PDF generator. Created by Smartsite PDF generator

Commands

The commands section defines the command that are applied when generating PDF documents. At this moment there is only one command defined: PdfCommand. Please note that the command and parameter approach is also used in the ImageProcessor.

PdfCommand Parameters
st Selectable text. Instructs PdfCreator to create a PDF document with / without selectable text. 0 = no selectable text, 1 = selectable text
w Pagewidth in pixels, if this is 0 or omitted, the pagewidth will be set automatically by the PDF rendering component. This may result in undesirable layout. a positive integer value
ls Pageorientation is landscape. 1=true, 0=false
pgs Pagesize: 0=letter, 1=note, 2=legal, 3=A0, 4=A1, 5=A2, 6=A3, 7=A4, 8=A5, 9=A6, 10=A7 11=A8, 12=A9, 13=A10, 14=B0, 15=B1, 16=B2, 17=B3, 18=B4, 19=B5
cpl Compression level: 0=abovenormal, 1=belownormal, 2=best, 3=bestspeed, 4=nocompression, 5=normal
hed Show document header. 0=do not show, 1=show
fot Show document footer. 0=do not show, 1=show
lmg Leftmargin in pixels. positive integer value
rmg Rightmargin in pixels. positive integer value
tmg Topmargin in pixels. positive integer value
bmg Bottommargin in pixels. positive integer value
pnr Show page number. This item will only be visible if docshowfooter = 1. 0=false, 1=true
htx Header text. The text displayed in the document header (this option can only be set from configuration). string
ftx Footer text. The text displayed in the document footer (this option can only be set from configuration). string

A request for a pdf document may look like the following

HTML CopyCode image Copy Code
<!-- create pdf doc -->
<a href="{html.location('/mypage.html?hid=pdf')}" />