PDF files are one of the most popular formats used for creating and editing online documents.
If you want to know how to add a PDF file and share it with your visitors, you came to the right place.
This article will teach you how to upload a PDF file to your WordPress website.
Why Upload PDF to WordPress
As mentioned above, PDF is a trendy format and a common way to save documents.
There are many reasons to upload PDF files to your WordPress website, and here are only some of them:
- Display long articles or user manuals in a downloadable file.
- Send an eBook to users that subscribed to your email list.
- Gift the content to users who purchased membership to your website.
- Increase engagement that will improve the time a visitor spend on your website. As a result, it will reduce the bounce rate and improve the overall SEO score.
Whatever the reason, uploading a PDF file to WordPress is a task you should know how to do.
In the next section, I will show you how to upload PDF files in three ways: first through the media library, second to a specific blog post or page, and lastly, by using a plugin.
How to Upload PDF Files to WordPress
Uploading PDF files to WordPress is a straightforward process, and you can do it in multiple ways.
Let’s start first by uploading PDF to the WordPress media library.
- From the backend of your WordPress website, navigate to Media -> Library and click on the Add New button to add a new file.
- Click on the select files button and drag your desired PDF file into the marked area.
- Once the file is finished uploading, you’ll be able to access it by navigating to the file’s URL path.
When the PDF file is hosted on your server, you can add it to your opt-in offer for your email campaign.
On the other hand, keep reading if you would like to add it to your blog posts or pages.
Embed PDF in a Page or Post
Once the PDF file is hosted on our website, we can embed it on any page or post.
The default pages or posts of WordPress use the Gutenberg editor, while custom post types use the old editor. Let’s start with Gutenberg first.
PDF in Gutenberg
When editing a page or a post, you’ll have the option to upload and embed a PDF file into it using the correct Gutenberg clock.
Click on the plus icon in your desired position to add a block.
First, type in and search for the file block. Then, click on it to add it to the content.
Next, choose if you would like to upload a new file or use the same PDF file you uploaded in the last section.
I’ll choose the file we uploaded earlier and click on select in this example.
Once you selected the PDF file, it was embedded inside the page and downloaded below.
After updating the changes, revisit the page and verify that the download button is working as expected.
If you’re trying to upload the file to a custom post type, you won’t use the Gutenberg editor. Therefore, use the classic editor instead.
PDF in the classic editor
Uploading files to the classic editor is similar to the Gutenberg one.
While under the visual tab, click on the add media button, select your PDF file and click insert.
If you didn’t upload any file yet, drag it into the library.
Once inserted, WordPress will add the file to the content. Unlike the Gutenberg editor, the classic editor won’t embed it but add a download link instead.
After updating the page, revisit it and click on the download link to verify it’s working as expected.
If you want to display PDF content in custom post types, we will need to use a dedicated plugin.
Embed PDF with a plugin
There are WordPress plugins for everything, and PDF files are no different.
We will need to use a plugin to embed a PDF on any post type (including customs).
Navigate to Plugins -> Add New and install the PDF Embedder plugin.
Once activated, open the page where you would like to display the file and click on the add media button.
We will use the same WooCommerce product that we used earlier in our example.
This time, after selecting and inserting the file, it will be added to the content as a shortcode.
The plugin will automatically insert the shortcode into the visual editor and transform it into a viewable file on the front-end.
Then, revisit the page and make sure the plugin embedded the PDF file successfully.
Create a Downloadable Link
If you would only like to create a download link of the file instead of displaying it, you can do that with simple HTML.
Creating a download link helps add a download link to your email campaign.
Switch to the visual tab of the editor and create a link tag with the PDF file path.
<a href="LINK GOES HERE">Download PDF</a>
Make sure to replace the LINK GOES HERE with the actual address of the file.
Then, add the download attribute into the tag to make it downloadable.
The complete code will look like that:
<a href="LINK GOES HERE" download>Download PDF</a>
Now, when visiting the page, you’ll be able to click on the link and download the file to your computer.
You learned how to upload and embed a PDF file in your WordPress website in this article.
Leave us a comment and tell us which methods you used to achieve this task.