Version: 5
🔥 Gravity PDF v5 end of life was 2023-04-28 and this version is no longer supported. This legacy documentation is kept for reference only.
gfpdf_mpdf_post_init_class
Description
This filter can be used to modify the mPDF settings before any HTML has been processed, but after Gravity PDF sets up the initial object.
Version
This filter was introduced in Gravity PDF 5.1.5.
Parameters
$mpdf | object
- The initialised
mPDF
class that handles the PDF generation
$form | array
- The current Gravity Form array
$entry | array
- The raw Gravity Form Entry array.
$settings | array
- The current PDF settings being processed
$Helper_PDF | object
- The initialised
\GFPDF\Helper\Helper_PDF
class
Usage
Use this filter to override any of the Gravity PDF default mPDF settings.
Below is a snippet to override the text direction in mPDF:
add_filter( 'gfpdf_mpdf_init_class', function( $mpdf, $form, $entry, $settings, $Helper_PDF ) {
$mpdf->SetDirectionality( 'ltr' );
return $mpdf;
}, 10, 5 );
Source Code
This filter is located in the Helper_PDF::begin_pdf()
method of /src/helper/Helper_PDF.php
.