Upgrade Legacy PDF Templates
Introduction
A legacy template is a custom PDF template written for Gravity PDF v3.0, which was released in 2013 and reached end of life in 2017. Version 4.0 introduced a new template format, and we kept the older templates working through a set of backwards compatibility layers. Those layers are removed in Gravity PDF 7.0.
Two Kinds of Legacy Template
Standard v3 templates are equal parts HTML, CSS and PHP. The file builds the markup, and Gravity PDF turns that markup into a PDF. Much of the PHP is boilerplate that the newer template format handles for you.
Business Plus/Tier 2 templates were built by our team via the custom PDF development service (known as the Bespoke PDF service today). Nearly all these templates import an existing PDF document and autofill it with Gravity Forms data.
How Gravity PDF Identifies a Legacy Template
Modern template files declare file headers at the top of the PHP file. A v3 template has no headers at all.
How to Tell if You're Affected
Gravity PDF reports legacy templates in three places in your WordPress admin:
- The Gravity PDF section of the Gravity Forms System Status page, under
Forms -> System Status - The WordPress Site Health screen, under
Tools -> Site Health - A dismissible notice on admin screens
The System Status and Site Health reports will list any legacy templates detected on your website, whether it's standard or Business Plus, and the form(s) they are configured on.
These reports look for the modern template header. Adding the header on its own will stop the warning, but it won't prevent the template breaking in Gravity PDF 7.0. You still need to complete the full upgrade.
Standard v3 Template Upgrade Guide
An Unmodified Core Template
Gravity PDF v3 shipped three templates of its own:
default-template.phpdefault-template-two-rows.phpdefault-template-no-style.php
If you never edited these templates, you can update your form(s) to one of the four modern Core templates – Zadani, Rubix, Focus Gravity or Blank Slate – and then delete the old template file.
A Template You Customized
You will need to rebuild your custom template in the modern format. This is usually straightforward and involves removing the boilerplate PHP and HTML and then adding the template header info.
The first custom template guide covers the latest template structure, and includes a minimal example of a modern template. If you only need cosmetic changes to a Core template, copying and modifying one is usually quicker than starting from scratch.
A Replacement From the Template Shop
The template shop sells Universal templates that cover common layouts. If you're not sure what your template does, or how much work the move involves, send our support team a ticket with the template file attached.
Switch Your PDFs Over
With the replacement in place, update every PDF that points at the old file. Go to Forms -> Settings -> PDF on the form, edit the PDF, and choose the new file from the Template dropdown. Generate a test PDF from an existing entry before you move on.
Delete the Old File
If you swap your form(s) to a modern PDF template, and everything is working, you should delete the old legacy template file. You can complete this step from the PDF Template Manager. Once done, reload the System Status page to check the warning has cleared.
Business Plus / Tier 2 Template Upgrade Guide
This is the upgrade path for a Business Plus template, and for any PDF with Enable Advanced Templating switched on.
Get in touch and we can help you upgrade. Nearly all of these templates autofill an existing PDF document, and will need a full conversion + new plugin to continue working.
If your template only reached into the engine for something that has a proper hook today, the move is more straightforward:
gfpdf_mpdf_classhands you the mPDF object after Gravity PDF has set it up.gfpdf_pdf_configsets the filename, paper size, orientation and security before the PDF is generated.gfpdf_pdf_html_outputchanges the HTML on its way into the document.