PDF Functions
PDF functionality to MADL which is accessible in the custom code area of BlinkForms Builder or can be used within a mADL Interaction.
$t->createPDF( )
The createPDF() MADL function returns a string for use in email, fetches, etc.
The following sample code shows the available options: ($options is optional)
Parameters # | An array of options including the following. |
---|---|
author | A String. Sets the author of the pdf |
header | A String. The header of the pdf. |
description | A String. The description of the pdf. |
footer | A String. The footer of the pdf. |
header_image | A place holder for the header image. |
style | Attach a custom CSS. |
include_fields | An array of fields you want in include. //exclude_fields have higher precedence than include_fields |
exclude_fields. | An array of fields you want in exclude. |
base64_encode | Boolean. To set base64 encoding on images. (Optional). |
Note
Leaving the include_fields & exclude_fields arrays blank will include all fields on the form.
Return Values | |
---|---|
$pdf_content = $t->createPDF($options); | An object to attach to an email |
Base64 Workaround
Any fields you wish to be excluded from the output simple add them to the exclude_fields array. Exclude_fields have higher precedence than include_fields. $pdf_content then can be added to an email attachment or sent as part of a web service. The workaround if base64 strings are required is
$t->AddStringAttachment($pdf_content, "NameYourPDF.pdf", "base64", "application/pdf"); Or if the attachment is in a separate location use AddAttachment($path, $name, $encoding = 'base64', $type = 'application/octet-stream')
$t->toPDF( )
Like $t->createPDF(), This function is used to create a custom PDF to attach to an email within the custom code area of Blinkforms of Blinkforms.
$t->toPDF() however differs in you now can not only create custom PDF's in BlinkForms, you can now use them within mADL Interactions as well.
$t->toPDF() is also fully customisable and includes some new mADL constants for easier development.
orientation (string) page orientation. Possible values are (case insensitive):
Parameters # | An array of options now including the following arrays and settings. | Possible values are (case insensitive): |
---|---|---|
base64 | (boolean) to return file as base64 decoded string (default is false) | |
page | An array containing the following parameters | |
orientation : (string) page orientation. Possible values are (case insensitive): |
| |
unit : (string) User measure unit.. |
| |
size : (string) page size | ||
margins : (array) for top, right, bottom and left margins (case sensitive) |
| |
imageScaling : (string) default is 1 | ||
family : (string) : default is arial unicode (to allow multi-language) | ||
border : (array) Indicates if borders must be drawn around the cell. The value can be a number: |
Or a string containing some or all of the following characters (in any order):
Or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) | |
align : (string) Allows to center or align the text. |
| |
meta | An array containing the following parameters | |
creator : (string) page creator | ||
author : (string) page author | ||
title : (string) page title | ||
subject : (string) page subject | ||
keywords : (string) page keywords | ||
security | An array containing the following parameters (only applied if [page][secure] = true | |
permissions : (Array) the set of permissions (specify the ones you want to block):
| ||
userPassword : (String) | ||
ownerPassword : (String) owner password. If not specified, a random value is used. | ||
mode : (int) encryption strength: |
| |
pubKeys : (string) | ||
header | An array containing your header styling and html code | |
margin : (array) use the same parameters as page:margin | ||
border : (array) use the same parameters as page:border | ||
font : (array) font parameters used in header
| ||
html : (string) containing your header html code | ||
footer | An array containing your footer styling and html code | |
margin : (array) use the same parameters as page:margin | ||
border : (array) use the same parameters as page:border | ||
font : (array) font parameters used in footer
| ||
html : (string) containing your footer html code | ||
body | An array containing your body styling and html code | |
margin : (array) use the same parameters as page:margin | ||
border : (array) use the same parameters as page:border | ||
font : (array) font parameters used in body
| ||
align : (array) use the same parameters as page:alignment | ||
html : (string) containing your body html code |
If you are using this function in the custom code area of BlinkForms you can still use the following methods in the PDF boy array
Parameters # | An array of options including the following. |
---|---|
include_fields | An array of your forms fields you want in exclude. |
exclude_fields. | An array of fields you want in include. Note: exclude_fields have higher precedence than include_fields |
{_BLINK_DATA_TABLE_} | A constant which when added to the body->html array will display all your BlinkForm fields in the standard BlinkForms PDF table layout |
Note
Leaving the include_fields & exclude_fields arrays blank will include all fields on the form.
Additional constants for the pdf
Parameters # | |
---|---|
{_BLINK_PAGES_} | A constant which when added to the header or footer array will display total number of pages |
{_BLINK_PAGE_NO_} | A constant which when added to the header or footer array will display the current page number |
Return Values | |
---|---|
$pdf_content = $t->toPDF($options); | An object |