Description
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
Parameter | Type | Details |
---|---|---|
$mpdf | Array | The mPDF instance which the PDF will be generated through |
$body | String | The PDF content |
$file_path | String | The PDF path |
$entry | Entry | The Entry object |
$step | Step | The workflow step |
Examples
Create a protected PDF with page numbers in header and footer and watermark text
1 2 3 4 5 6 7 8 9 10 | 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 can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?