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

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, 3 );
    function gravityflow_filter_gravityflowpdf_mpdf( $mpdf, $body, $file_path ) {
    	// 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.