gravityflowpdf_mpdf

The gravityflowpdf_mpdf filter is used to customize the mPDF instance, which will be used to generate the PDF based on the template (defined in step settings) and entry field values. Refer to https://mpdf.github.io/reference/mpdf-variables/overview.html for more details on configuration options.

Parameters

$mpdf        object    The mPDF instance which the PDF will be generated through
$body        string     The PDF content
$file_path  string     The PDF path
$entry        object     The Entry object
$step          object     The workflow step

Examples

Example 1 - Create a protected PDF with page numbers in header and footer and watermark text

add_filter( 'gravityflowpdf_mpdf', 'gravityflow_filter_gravityflowpdf_mpdf', 10, 5 );
    function gravityflow_filter_gravityflowpdf_mpdf( $mpdf, $body, $file_path, $entry, $step ) {
    	// modify $mpdf properties
		$mpdf->SetProtection(array());
		$mpdf->setFooter('{PAGENO}');
		$mpdf->setHeader('{PAGENO}');
		$mpdf->SetWatermarkText('Gravity Flow');
		$mpdf->showWatermarkText = true;
    	return $mpdf;
    }

Placement

This code should be placed in the functions.php file of your active theme.