All You Need To Know About Creating a PDF for Gravity Forms
Creating a PDF for individual Gravity Forms is similar to creating Notifications. There are a lot of options available to you, but we've put the most common settings up front. The rest are hidden; split up between four sections:
- General - Common settings like label, filename, PDF template, and Notification attachments
- Appearance - Control the paper size and orientation as well as the font type, size and colour.
- Template - Template-specific settings: different templates can have different options
- Advanced - Advanced settings like document format and security options
To aid you in managing your PDF settings, an Add/Update button is included below every section, and you can collapse/hide sections by selecting the section title or associated toggle.
Locating the PDF Settings
The PDF settings for an individual form can be accessed by following these steps:
- Navigating to
Forms -> Forms
in your WordPress admin area. - Locate the form you want to create a PDF for, then hover your mouse (or similar device) over that particular row. A list of actions will be revealed; click the
Settings
action. - When the page loads, you'll see a navigation item called
PDF
in the left sidebar. Click that link. - Finally, select the
Add New
button which is above-and-to-the-right of the table shown in the content area.
Only users with the gravityforms_edit_forms
capability can manage the form PDF settings (prior to v6.4 this was the gravityforms_edit_settings
capability). By default, this is users with the administrator role.
Required Fields
There are only two required fields when creating a PDF: Label and Filename. The rest of the settings will either use sane defaults, those configured in the Global Settings, or be disabled / empty. These settings can be found in the General section.
Label
- The label is only used for internal administrative tasks. Its sole purpose is to provide a human-readable identifier for the particular PDF.
- The label can help you distinguish between multiple PDFs in your WordPress admin area. It's best to choose something meaningful and easy to remember.
In previous versions of Gravity PDF this setting was know as the Name.
Filename
- The filename is what the generated PDF will be called when saved. For example,
My_Personal_Flyer.pdf
. - Gravity Forms merge tags are supported in the filename. Any merge tags will be converted to the appropriate value when the PDF is saved. For example,
{Name:3}_Personal_Flyer.pdf
will becomeGravity PDF_Personal_Flyer.pdf
if Gravity PDF was entered into field 3 for the current entry. - If you use merge tags, either use a field marked required or include static text alongside the merge tag to prevent empty filenames.
- The
.pdf
extension should be excluded from the filename field (but will be automatically removed if you add it). - While the following characters will be saved, they are automatically converted to an underscore when generating the PDF:
/ " * ? | :
. This is to prevent problems saving the PDFs to disk on some operating systems. If you have multiple PDFs configured on a single form, make sure the Filename is unique for each document, otherwise the PDF Notification attachments feature andFrom Gravity PDF v6.7, the Filename does not need to be unique.gfpdf_post_save_pdf
hook won't work correctly.
Optional Fields
There are a number of optional fields available which give you granular control over how the PDF functions. Each field belongs to one of four sections which are covered below.
General Section
Below is the list of settings available in the General section, with a brief description about what each is for.
Template
- Select the PDF template that should be used to generate the document. The global Default Template setting controls which template will be preselected.
- Gravity PDF comes with four free templates for you to choose from. Upon changing your selection (using the drop down or selecting the Manage button to get a more graphical overview), the Template section will be updated (or removed if it has no options) to reflect the template-specific options.
- Additional templates can be purchased from our template shop and then installed through the PDF Template Manager.
- Developers with HTML, CSS and a little PHP knowledge can also create their own designs and layouts. Alternatively, the Gravity PDF team offers a Bespoke PDF service for those wanting us to build it for them – we can even populate existing PDF documents (not available in the free plugin).
Notifications
- This setting allows you to automatically attach the PDF to the selected notification(s).
- The PDF active state and Conditional Logic determine if the PDF will be attached to the notification. If one or both of these tests fail, no PDF will be attached. This setting does not affect the actual notification conditional logic (which determines if the notification should be sent).
- If Background Processing is enabled, during the form submission when it's determined a PDF should be attached to a notification, Gravity PDF will handle the PDF generation and notification sending as a background task. The major benefit is the end-user doesn't have to wait for these tasks to complete before seeing the form's Confirmation page. Resending notifications from your admin area will also be processed as a background task.
- If there is semi-sensitive user information included in the PDF, it's recommended you also enable PDF Security with a strong Password (more than 12 characters, with a mix of symbols, numbers and upper and lower case). Password-protected PDFs are encrypted using 128-bit AES.
- If very sensitive user information is included in the PDF, it is recommended you do not enable this feature as email can be insecure. Instead use the
[gravitypdf]
shortcode over HTTPS so users have to login and pass PDF security checks before the document can be viewed or downloaded.
Conditional Logic
- Conditional logic is a powerful feature of Gravity Forms allowing you to show or hide fields in your form based on a user's response. We've extended this behaviour to Gravity PDF, allowing you to enable or disable a PDF if a user responded a specific way.
- If the conditional logic determines a PDF should be disabled, it will not be generated for that entry. The PDF will not be accessible through the
[gravitypdf]
shortcode or PDF merge tags, and will not be attached to notifications. Site administrators won't be able to access it from the admin area either.
If you enjoy learning through video, you can watch this 18-minute video with Gravity PDF's lead developer showing you how to set up multiple PDFs in a single Gravity Form, and use Conditional Logic to conditionally deliver different PDFs based on user input.
Appearance Section
The Appearance section contains fields that control the general look and feel of your PDF. You have control over the paper size and orientation, as well as the font, font size / colour and RTL support.
Paper Size
- Use this option to set the PDF paper size.
- This field defaults to the Default Paper Size option in the global settings.
- Common paper sizes like A4, US Letter and Legal are available. The ISO-standard A, B and C paper sizes, as well as RA and SRA, can also be selected.
- If none of the preloaded options suit, you can also select Custom Paper Size and control the width and height in millimetres or inches.
Custom Paper Size
- This field is hidden until you select the Custom Paper Size option from the Paper Size field. It allows you to control the exact paper size of your document – in millimetres or inches.
- When displayed, this field is required, and only positive numbers or floats are permitted in the width and height inputs.
Orientation
- This allows you to change the paper orientation from portrait to landscape. A page displayed in portrait mode is taller than it is wide. Inversely, landscape pages are wider than they are tall.
- The field defaults to Portrait.
Font
- Select the font to be used in your PDF.
- This field defaults to the Default Font option in the global settings.
- If none of the pre-installed fonts suit your needs, additional fonts can be installed by selecting the Manage button, which will open the Font Installer.
Font Size
- Control the font size used in the PDF.
- The field defaults to the Default Font Size option in the global settings.
Font Colour
- Control the font colour used in the PDF.
- The field defaults to the Default Font Colour option in the global settings.
Reverse Text (RTL)
- Control the text direction used in the PDF.
- The field defaults to the Reverse Text (RTL) option in the global settings.
Template Section
The template section contains the current template-specific settings. A template may support dozens of custom settings, or none at all (and the section will be hidden).
Below is a description of the Core template settings that all four free templates that ship with Gravity PDF include.
Show Form Title
- Display the form name at the beginning of the PDF document.
- This is disabled by default.
Show Page Names
- When using Gravity Forms Page Break field you have the option to name each page using the Start Paging field. When this PDF option is enabled the page names will be displayed in your PDF.
- If a Page Break field has conditional logic, and the Enable Conditional Logic setting is enabled, that logic will is evaluated in the PDF. If the page is hidden, both the page title and all fields on the page will be excluded from the PDF. This feature was added in Gravity PDF 6.10.1.
- If a Page Break field uses the "exclude" CSS class added, the page name will not be shown in the PDF. This feature was added in Gravity PDF 6.10.1.
- This is disabled by default.
Show HTML Fields
- Show your form's HTML fields in the PDF.
- If your HTML has conditional logic, this will be honoured in the PDF. See Enable Conditional Logic to disable this feature.
- This is disabled by default.
Show Section Break Description
- The Section Break field allows you to enter a label and description. By default, a PDF will only show a section break's label. Enabling this option will also show the description.
- This is disabled by default.
Enable Conditional Logic
- When this option is enabled, the Gravity Forms field conditionals you set in your form will be adhered to in the PDF. This means if a field's conditional logic says it should be hidden, then it won't be included in the PDF.
- This option is useful when you have Show Empty Fields enabled.
- This is enabled by default.
Show Empty Fields
- By default, any field not completed by the user won't be shown in the PDF document. When enabled, this option will display all fields, regardless of whether the user filled it out.
- Conditional logic is honoured on all fields, including empty ones. See Enable Conditional Logic to disable this feature.
- This is disabled by default.
Background Color
- Set the background color for all pages in the PDF
- By default, this is set to white (hex
#FFFFFF
)
Background Image
- Set the background image to be used for all pages in the PDF
- For the best results, create an image with the same dimensions as the Paper Size and then run through an image optimization tool before you upload.
- This is disabled by default
Header
- Add a header to your PDF document using the WordPress Classic Editor. You can use the media library to include a simple logo. Or add a more robust three-column table (try this code snippet).
- Gravity Forms merge tags can be used in the header.
- The special tags
{PAGENO}
– which displays the current page number – and{nbpg}
– which displays the total number of pages in the document – can be used in the header. - Images will have their height restricted, so they don't take up too much of the page. Learn how to override this behaviour.
First Page Header
- When enabled, you can add a different header to the first page of your PDF document.
- Gravity Forms merge tags can be used in the header.
- The special tags
{PAGENO}
– which displays the current page number – and{nbpg}
– which displays the total number of pages in the document – can be used in the header. - Images will have their height restricted, so they don't take up too much of the page. Learn how to override this behaviour.
Footer
- Add a footer to your PDF document using the WordPress Classic Editor. You can use the media library to include images. Or add a more robust three-column table that includes the page number and date (try this code snippet).
- Gravity Forms merge tags can be used in the footer.
- The special tags
{PAGENO}
– which displays the current page number – and{nbpg}
– which displays the total number of pages in the document – can be used in the footer. - Images will have their height restricted, so they don't take up too much of the page. Learn how to override this behaviour.
First Page Footer
- When enabled, you can add a different footer to the first page of your PDF document.
- Gravity Forms merge tags can be used in the footer.
- The special tags
{PAGENO}
– which displays the current page number – and{nbpg}
– which displays the total number of pages in the document – can be used in the footer. - Images will have their height restricted, so they don't take up too much of the page. Learn how to override this behaviour.
Advanced Section
The Advanced section allows you to control the PDF security (which includes password protection). You can also change the image DPI and the PDF format.
Format
- This allows you to change the PDF to one of the ISO-standard PDF/A-1b or PDF/X-1a formats.
- The PDF/A-1b standard is designed for long-term archiving and is 100% self-contained. All the information necessary for displaying the document is embedded in the file.
- The PDF/X-1a standard is designed to facilitate printing. Like the PDF/A-1b standard, the document is 100% self-contained but has the added restriction that all images need to be CMYK or spot colours. The software will try automatically convert any images to CMYK.
- Both the PDF/A-1b and PDF/X-1a standards do not allow transparency, which means you cannot use watermarks or PNG images with alpha channel transparency. Additionally, the PDF Security option is automatically disabled – which includes the Password and Privileges fields.
Enable PDF Security
- When the Format is set to Standard, you have the option to enable PDF security. This allows you to set a password to access the PDF or control the end-user document privileges.
Password
- When PDF Security is enabled, you have the option to password-protect your PDF documents.
- Merge tag usage is allowed in this field.
- Leave this field blank if you don't want to set a password (useful if you only want to control the end-user Privileges)
In the PDF world, this password is known as the Unlock Password. It should not to be confused with the Owner/Permissions Password, which is randomly generated for each PDF. Add this filter to your site to manually control the Owner/Permissions Password.
Privileges
You can restrict what the end user does with the PDF by removing privileges. The following privileges are available:
- Annotate: Add or modify text annotations.
- Assemble: Allow users to insert, delete or rotate pages.
- Copy: Allow users to copy and pasting content from the document.
- Extract: Allow users to split or extract pages from the document.
- Fill Forms: Allow users to fill in any active form field elements.
- Printing - High Resolution: Allow high quality printing and PDF re-distilling.
- Printing - Low Resolution: Low-resolution printing will generate a bitmapped image of the document that is suitable for personal use. High-quality reproduction and re-distilling is disabled. If you don't want the user to print at all remove both Printing privileges.
- Modify: If this privilege is removed, document modifications are disabled. However, copying, extracting content and printing are allowed.
Do not rely on privileges to restrict what a user can do with the PDF, as they are easily bypassed with simple tools. This is a limitation of the PDF specification and not Gravity PDF. Use this feature to convey intention and, optionally, combine with an appropriate license to inform the user what they legally can and cannot do with the document.
Image DPI
- Adjust the image DPI (Dots Per Inch). By default this is set to 96. If professionally printing you should set this to 300 and change the Format to PDF/X-1a.
Enable Public Access
- Enabling public access to the PDF will disable all security protocols and give anonymous users access to the PDF. This means anyone worldwide can view the PDF document for all your form's entries.
- For most users, the standard security measures will be adequate, and public access should remain disabled.
- A good middleground between the default security and public access is Signed PDF URLs, as it allows anyone with access to the secure signed PDF URL to view the document.
Restrict Owner
- This option is used to prevent the original entry owner (the person who submitted the form) from viewing the generated PDF.
- This option defaults to the global Default Owner Restrictions value, but you have the option to override that behaviour on a per-PDF basis.
- Logged-in users who have one of the capabilities enabled in the User Restriction setting will still be able to access the PDF
- Signed PDF URLs will ignore this setting.
The Always Save PDF setting has been removed from the UI. As the sole reason for this setting was to allow developers to use the gfpdf_post_save_pdf
action, we now automatically enable this functionality when the action is hooked into.