This filter allows you to manipulate the raw PDF template HTML before it's sent to mPDF for rendering. This is a quick and dirty way to modify the PDF HTML dynamically. If you are instead looking to modify a field's mark-up there are better filters for the job.
If you do use this filter we recommend making your changes using a DOM parser. Gravity PDF includes the QueryPath library, which is specifically designed to make it simple to manipulate HTML.
$html | string
- The PDF template HTML in string format
$form | array
- The current Gravity Forms array
$entry | array
- The raw Gravity Forms Entry array.
$settings | array
- The current PDF configuration array.
$Helper_PDF | object
- The initialised
This snippet uses the
GFPDF\\Helper\\Helper_QueryPath class to load, manipulate and return our HTML. In this sample we're making the colour of all our v4 template labels red.
You might also like to use this filter to insert new mark-up between certain fields. This snippet inserts a
<hr /> tag every three rows – but you could change that to a page break or any other HTML tag:
As you can see the Query Path library is very powerful and we strongly recommend you use it for manipulating HTML.
If you need to, you also have the option to specifically target PDF templates assigned to individual Gravity Forms:
This filter is located in the
Helper_PDF::render_html() method of