How do I create a PDF in the custom code area of BlinkForms?


PDF functionality to MADL which is accessible in the custom code area of BlinkForms.

The createPDF() MADL function returns a string for use in email, fetches, etc. 

The following sample code shows the available options: ($options is optional)

$options = array(
        'author' => 'Testing',
        'header' => 'Header',
        'description' => 'Description',
        'footer' => 'Footer',
        'header_image' => '',
        'style' => ' th {
                        background-color: #C2CAD1;
                        color: #000000;
                        font-weight: bold;
                    .odd {
                        background-color: #C1E5FF;
                        color: #000000;
                    .even {
                        background-color: #E8E8E8;
                        color: #000000;
                        background-color: #336699;
                        color: #FFFFFF;
                    .required {
                        color: #cc0000;
                        font-weight: bold;
                        font-size: 30px;
        'include_fields' => array(), //exclude_fields have higher precedence than include_fields
        'exclude_fields' => array(
                        'SubformField2' => array(
                                'SSubField2' => array(
        'base64_encode' => false

//function call
//the argument is optional
$pdf_content = $t->createPDF($options);

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')