Previewer is a premium plugin for Gravity PDF that allows the user to review the PDF(s) before the form has been submitted. The extension goes hand-in-hand with a bespoke PDF or one of our premium PDF templates.
You can purchase the Previewer plugin from our Extension Shop. This guide will walk you through installing and configuring Previewer to its full potential.
Please follow our installation guide, which provides instructions for uploading the add-on to your WordPress website and adding your license key for automatic updates.
Note: WordPress Permalinks and the REST API must be enabled to use this plugin.
This extension adds a new field called PDF Preview to the Gravity Forms Editor, and can be found under the 'Advanced Fields' section. To correctly setup the Previewer field, you first need to configure a PDF on your chosen Gravity Form.
PDF Preview Options
Once you've added the PDF Preview field to the form, you have a number of options that can be configured. The field supports the following standard Gravity Forms options:
- Field Label
- Custom CSS Class
- Conditional Logic
Options specific to the PDF Preview field include:
PDF to Preview
: A dropdown that allows you to select one of the active PDFs configured on the current Gravity Form the end user can preview.
: The height in pixels of the preview should be displayed at. The default height is 600px. : The width of the preview will always be 100% and fill the container the form is embedded in.
: When enabled, a 'download' button will be included in the PDF Preview so the user can download the generated PDF : After a PDF is downloaded it'll automatically be removed from the server. To download the PDF a second time the user might need to refresh the Previewer (whether they do or not will depend on the browser they're using).
: In the preview, text is overlaid diagonally on each page of the generated PDF : You can change the watermark text displayed, and the font.
If you've got multiple PDFs configured on a single Gravity Form you may want to allow the end user to preview each of those documents. You can add multiple PDF Preview fields to the form and display each of your configured PDFs.
Bonus Feature: Use Gravity Forms CSS Ready Classes – like
gf_right_half – to display the previews side by side.
Conditional Logic is fully supported for the PDF Preview field. Set it up from the field's Advanced Tab in the Form Editor.
The Previewer is fully-functional with the Gravity Flow (version 2.0+) User Input step, including when using conditional logic on the Previewer or manually selecting which fields to display. It's not currently possible to use the Previewer during the Approval Step.
File Upload Limitations
If using the File Upload field with the Multi-File Upload option disabled, the Previewer will need to be on a different page in the form (using Gravity Forms Page fields) for those uploads to display in the PDF preview. This is a limitation of how the File Upload field works.
Conditionally Show Content
To conditionally display content in the PDF Preview you can use the
DOING_PDF_PREVIEWER constant in your custom PDF template. For example:
Blurry Background Image
There's a bug in PDF.js (the library we use to preview PDFs in your browser) that can cause background images to be blurry in the Previewer. There are two different workarounds available, both requiring modifications to your PDF template.
Originally, your template might have the following code:
Background on Single Page
If you only need to display a background image on a single page of your PDF, adjust your template as follows:
Background on Multiple Pages
If you need your user content to expand across multiple pages, and include your background image on each page, you can commandeer the PDF Header like so:
PDF Security in Previewer
By default, when you've allowed your user to download the PDF via the Previewer the PDF Security settings are disabled. To use the security you've set in the PDF settings, include the following snippet in your active theme's functions.php file: