Skip to main content

How to Embed a PDF in Your Gravity Form

You can display a PDF directly within your Gravity Form by uploading it to your WordPress Media Library and then embedding it using an HTML field.

Updated over a week ago

Step 1: Upload Your PDF to Media Library

  1. In your WordPress dashboard, go to Media > Add New

  2. Click Select Files and choose your PDF

  3. Once uploaded, click on the PDF to open its details

  4. Copy the File URL (it will look something like: https://yoursite.com/wp-content/uploads/2024/02/document.pdf)
    ​

Step 2: Add an HTML Field to Your Form

  1. Open your form in the Gravity Forms editor

  2. From the Standard Fields section, drag the HTML field to where you want the PDF to appear

  3. Click on the HTML field to edit it

Step 3: Add the Embed Code

Paste this code into the HTML field, replacing YOUR-PDF-URL with the File URL you copied in Step 1:

html

<embed src="YOUR-PDF-URL" type="application/pdf" width="100%" height="600px" />

Example:

html

<embed src="https://yoursite.com/wp-content/uploads/2024/02/membership-agreement.pdf" type="application/pdf" width="100%" height="600px" />

Customization Options

You can adjust the appearance by modifying these values:

  • width: Change 100% to a specific pixel value like 800px for a fixed width

  • height: Adjust 600px to make the viewer taller or shorter (common values: 400px to 800px)


Alternative: Link to PDF Instead

If you prefer users to open the PDF in a new tab rather than viewing it embedded in the form, use this code instead:

html

<a href="YOUR-PDF-URL" target="_blank">Click here to view the document</a>

Troubleshooting

PDF not displaying?

  • Verify the File URL is correct and accessible

  • Some browsers may not support embedded PDFs - in this case, they'll prompt the user to download instead

  • Mobile devices may have limited support for embedded PDFs

Need the PDF to appear conditionally?

  • Use Gravity Forms conditional logic on the HTML field to show the PDF only when certain form conditions are met

Did this answer your question?