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 for more details on configuration options.


$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


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->SetWatermarkText('Gravity Flow');
		$mpdf->showWatermarkText = true;
    	return $mpdf;


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