Help Center

Displaying a PDF File with Dynamic Widgets

Learn the ways of displaying the PDF files with the Dynamic Widgets using the WordPress JetEngine and JetElements plugins.

Before you start, check the tutorial requirements:

  • Elementor (Free version)

  • JetEngine plugin installed and activated

This article focuses on three ways to display PDF files using the Dynamic Widgets and buttons with the WordPress JetEngine and JetElements plugins.

Download the PDF through the Button

This solution requires the JetElements plugin installed and activated.

The PDF file should be added to the “Media” field. For this case, the “Media” meta field stores the value as “Media ID”.

media id value format

Go to the post and add the PDF file to the “Media” field.

pdf file added to the media field

Proceed to WordPress Dashboard > Crocoblock > JetPlugins Settings > JetElements > Widgets & Extensions and enable the Download Button toggle.

Things to know

The number of activated widgets may impact the website's performance, so only the required ones should be enabled.

download button widget enabled

Move to the page where you need to display the PDF file. Add the Download Button widget. 

In the Download ID dropdown, select the “Custom Field” option. In the newly opened pop-up, choose the Field that stores the PDF file. You can set up the desired Download Link Text

download button widget set up

Click the “Publish” button once you are ready and open the front-end page. 

Now, when you click the “Download” button, the file is downloaded. 

download button added on the front

The second solution describes how to display a link to the PDF file. 

To achieve this, first of all, install the Attachment link callback addon. You can find it on the DevTools page and install it for free. 

The Value Format of the “Media” field should have the “Media ID” option selected. 

media id value format

Proceed to the page where you need to display the PDF file. Add the Dynamic Field widget.

In the Source dropdown, choose “Meta Data”. Then, select the custom Media field you have created with JetEngine (it’s called “PDF-Media” in our case) in the Meta Field dropdown.

Enable the Filter field output toggle. In the Callback field, select the “Get attachment file link by ID” option.

pdf link displayed with the dynamic widget

Click the “Publish” button and proceed to the front-end page. Now, clicking the link we added, we can open and download the PDF file on the same page. 

pdf link displayed on the front

Show PDF File Content with the Dynamic Field Widget

The third option supports only the “Media URL” Value Format of the “Media” field.

media url value format

Move to the needed page and add the Dynamic Field widget. 

Select the “Meta Data” option from the Source dropdown. Then, choose the custom Media field you’ve created (“PDF-Media URL” in this case) in the Meta Field dropdown.

Enable the Customize field output toggle. In the newly appeared Field format input, add the following code:

<object>
    <a href="%s" target="_blank" rel="noopener">Download PDF</a>.</p>
</object>
Warning

Ensure that the "%s" value is used in the code, as it represents the field's value. The provided code is a basic example; feel free to customize it according to your needs.

customized field output

Publish the template and proceed to the front end. Clicking the link opens a PDF file in a new tab and lets you download it. 

pdf url link on the front

Now, you know three ways to display a PDF file using JetEngine dynamic widgets and JetElements’ button on the WordPress site. 

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 30K+ Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.