Skip to content

Usage

How it works

The FormIt2PDF hook creates a PDF file with the submitted form values. The PDF content can be set with the chunk referenced in pdfTextTpl. The PDF style can be set with the chunk referenced in pdfStyleTpl. Both chunks can use placeholders for each form field and a formit2pdf.formfields placeholder for a combination of all submitted form fields. The PDF file is attached to the mail sent with the default FormIt email hook.

The FormIt hook uses the following properties. Most of the properties default to the value of the according system setting in the formit2pdf namespace.

Hook Properties

Property Description Default
pdfAuthor Author of the PDF file -
pdfCreator Creator of the PDF file -
pdfCustomFonts JSON encoded object of custom fonts, see Fonts in the mPDF documentation for the array format. Please copy the font files to the folder referenced in the formit2pdf.customFontsFolder system setting. -
pdfCustomFontsFolder Path to the custom fonts folder. If the path is not set or available, formit2pdf.customFonts is not used. The {core_path}, {base_path} and {assets_path} placeholders can be used in this setting. -
pdfDefaultFont Default font of the generated PDF -
pdfDefaultFontSize Default font size of the generated PDF -
pdfFilename Filename of the generated PDF attachment.pdf
pdfFormat PDF page size. If you want to change the orientation of a "named" PDF page size you have to append -L to the PDF page size string (i.e. A4-L). -
pdfMPDFMethods JSON encoded array of callable mPDF method names -
pdfMgb Bottom Margin of the generated PDF -
pdfMgf Footer Margin of the generated PDF -
pdfMgh Header Margin of the generated PDF -
pdfMgl Left Margin of the generated PDF -
pdfMgr Right Margin of the generated PDF -
pdfMgt Top Margin of the generated PDF -
pdfMode mPDF mode. See mode parameter and choosing a configuration in the mPDF documentation for possible values. -
pdfMultiSeparator The default separator for array values sent through checkboxes/multi-selects. Defaults to ’,’. -
pdfOrientation PDF Orientation. If you want to change the orientation of a "named" PDF page size you have to append -L to the PDF page size string (i.e. A4-L). -
pdfOwnerPassword Password for full access and permissions to the generated PDF -
pdfPermissions JSON encoded array of permissions granted to the end-user of the PDF file. see permissions in the mPDF documentation for possible values. -
pdfStyleTpl Template chunk for the PDF style tplFormIt2PDFStyle
pdfTextTpl Template chunk for the PDF text tplFormIt2PDFText
pdfTitle Title of the PDF file -
pdfUserPassword Password required to open the generated PDF -

System Settings

If you use the FormIt hook multiple on the website, it is easier to set the default snippet properties with the following system settings.

Key Name Description Default
formit2pdf.author PDF Author Author of the PDF file. -
formit2pdf.creator PDF Creator Creator of the PDF file. -
formit2pdf.customFonts Custom Fonts JSON encoded object of custom fonts, see Fonts in the mPDF documentation for the array format. Please copy the font files to the folder referenced in the formit2pdf.customFontsFolder system setting. -
formit2pdf.customFontsFolder Custom Fonts Folder Path to the custom fonts folder. If the path is not set or available, formit2pdf.customFonts is not used. The {core_path}, {base_path} and {assets_path} placeholders can be used in this setting. {core_path}components/customfonts/
formit2pdf.debug Debug Log debug information in the MODX error log. No
formit2pdf.defaultFont PDF default font Default font of the generated PDF. -
formit2pdf.defaultFontSize PDF default font size Default font size of the generated PDF. -
formit2pdf.format PDF page size If you want to change the orientation of a "named" PDF page size you have to append -L to the PDF page size string (i.e. A4-L). A4
formit2pdf.mPDFMethods mPDF Methods JSON encoded array of callable mPDF method names. []
formit2pdf.mgb PDF margin bottom Bottom Margin of the generated PDF. 16
formit2pdf.mgf PDF margin footer Footer Margin of the generated PDF. 9
formit2pdf.mgh PDF margin header Header Margin of the generated PDF. 9
formit2pdf.mgl PDF margin left Left Margin of the generated PDF. 15
formit2pdf.mgr PDF margin right Right Margin of the generated PDF. 15
formit2pdf.mgt PDF margin top Top Margin of the generated PDF. 16
formit2pdf.mode mPDF mode See mode parameter and choosing a configuration in the mPDF documentation for possible values. -
formit2pdf.orientation PDF Orientation If you want to change the orientation of a "named" PDF page size you have to append -L to the PDF page size string (i.e. A4-L). P
formit2pdf.ownerPassword PDF Owner Password Password for full access and permissions to the generated PDF. -
formit2pdf.permissions PDF Permissions JSON encoded array of permissions granted to the end-user of the PDF file. see permissions in the mPDF documentation for possible values. []
formit2pdf.styleTpl PDF style chunk Template chunk for the PDF style. You could use @FILE binding to retreive the chunk from a file. tplFormIt2PDFStyle
formit2pdf.textTpl PDF Content Chunk Template chunk for the PDF content. You could use @FILE binding to retreive the chunk from a file. tplFormIt2PDFText
formit2pdf.userPassword PDF User Password Password required to open the generated PDF. -