Skip to main content
Version: 3

Display PDF in Browser

The generated PDF can easily and securely be displayed in a users browser once the form has been submitted using the Gravity Form redirect setting.

Security

Before we discuss these methods just a note on security. To prevent unwanted users accessing sensitive data each PDF displayed using this method will check three things:
  1. If the user is logged in and their user ID matches the ID on the entry.
  2. Or, if the user's IP address matches the IP address on file for the entry.
  3. Or, if an administrator is logged in with read privileges for Gravity Forms entries.

Passing Form Values

You'll need to pass all of the following values to a URL you create in order to display the PDF in the browser:
  • fid={form_id}
  • lid={entry_id}
  • gf_pdf=1
  • template=custom-template.php
The fid and lid parameters take information using Merge Tags, gf_pdf won't change and template will refer to the template file you would like to use when generating the PDF.

Example

Text Confirmation Method

The Gravity Forms text confirmation message. You can pass in the appropriate values to the 'text' confirmation and allow users to download a copy of the PDF right after submitting their form.

Page Confirmation Method

This option is more complex than the other two options as you need to install a third party plugin which allows you to use the URL parameters in the page you point to.

First download and install the URL Params plugin. Next, go to your form's confirmation page and configure it to look like the screenshot below.

Set you form's configuration settings like so. Set you form's configuration settings like so. You can point to any page you like.

Finally, go to your WordPress page you linked to and, using the PDF Params plugin, you can construct the PDF link and access the form ID and entry ID parameters.

The WordPress 4.2.3 Security Release changes the way the Shortcode API works. You can no longer include a shortcode with the matching quotes inside a HTML attribute - this is invalid: <a href="[urlparam param="lead_id"]">. The simple fix is to remove the quotes from the shortcode - this is valid: <a href="[urlparam param=lead_id]">.

Redirect Confirmation Method

The Gravity Forms redirect confirmation message You can automatically redirect users to the generated PDF right after submitting their form

Automatically print when PDF is opened

Note: This feature isn't compatible with the PDF security features or when sending PDFs via email.
Note: Some PDF viewers don't adhere to this option.
Added in v3.4.0
Adding &print=1 to the PDF URL By adding &print=1 to the URL a print dialog box will automatically open when the PDF does.

To automatically force a print dialog box to be displayed when the PDF is viewed or downloaded from your website you can append &print=1 to your PDF link.