How to add a PDF download link to your View
If you are using Gravity PDF to generate PDF files after form submission, then you can easily add a link to your View to let users visualize or download these PDFs. Read more about this here.
NEW: PDF for GravityView, a new Gravity PDF add-on for GravityView that helps you create custom-styled PDFs for your single entries.
In this article, you will learn how to add a PDF download link to your View, allowing users to download individual entries as PDFs.
1. Installing GravityExport (required)
You'll need to start by installing GravityExport. You can do this from the "Products & Licenses" page under the "GravityKit" menu item in WordPress. GravityExport is our plugin that allows you to export Gravity Forms entries to CSV, Excel or PDF using a secure download URL.
After activating GravityExport, you'll need to create a new export feed and enable the download URL.
2. Creating a new export feed
Locate the form that's attached to your View and go to the form settings page. Now, click on "GravityExport Lite" and enable the download.
Now set the report file extension to ".pdf".
Make sure you configure the remaining options and save the feed. After that, scroll up and copy the download URL.
The next step is to construct the PDF download link and add it to a View.
3. Adding the PDF download link to your View
Now edit your View in GravityView and add a Custom Content field where you want the download link to show up. You can do this by clicking on the "Add Field" button and selecting "Custom Content".
Open the Custom Content text editor by clicking on the gear icon. Inside the editor, add an HTML anchor link using the download URL you generated in the previous step. Just make sure to add ?entry={entry_id}
to the end of the URL.
When you're done, simply save your View and check it out on the front end.
That's it!
If you want to create an attractive button, you'll need to add a class and custom styles. Here is some code you can use to achieve the above look (just make sure to replace the download URL with your own!):
<a class="button-pdf" href="https://testing.try.gravitykit.com/gf-entries-in-excel/0bcbb585fbd250ab94af7e0796c5d7b0c31df4eeb284c48f6632cd3dfec148c8?entry={entry_id}">Download as PDF</a> <style> .button-pdf { padding: 20px 10px; color: #fff; background-color: #808080; border-radius: 9px; box-shadow: 0px 2px 3px rgba(19, 126, 180, .30); padding: 15px 32px; display: inline-block; font-size: 18px; text-align: center; text-decoration:none; } .button-pdf:hover { color:#ffffff; background-color: #595959; } </style>