WordPress's default setting allows you to display a PDF file embedded in a post or page in a separate tab. But, this doesn’t necessarily mean that there’s no way around.
With these simple methods, you can embed a PDF file in WordPress easily without any hassle. You can access these files on your site without automatically downloading them.
This feature can make a real difference in the user experience. The methods listed in the article below can come in handy when you need to work with PDF files on your website.
Let’s learn how to embed a PDF file in WordPress.
Table of Contents
- Can I embed a PDF file in WordPress?
- How to embed a PDF file in WordPress?
Can I embed a PDF file in WordPress?
When you upload a PDF file in WordPress post or page, just like you upload an image or media file, WordPress converts it to a link. If you click on the link, it either downloads the PDF file or opens up in a new tab.
Now, what if you want to embed a file to a post or a page and display it along with the post?
There are different ways to do that. In the article below, we’ll talk about how to use Google Drive and WordPress plugins manually.
Plugins make your job easier and faster. But, it also uses up your resources and may slow down your website a bit. Likewise, you can use Google Drive, too, but it might be a tedious process for some.
How to embed a PDF file in WordPress?
There are two ways to embed a PDF file in a WordPress site. The first is to embed it manually using Google Drive while the second is by using plugins.
1. Manually embed PDF file in WordPress
Google Drive is an excellent option for those who do not want to use plugins to embed a PDF file in a WordPress site. You can use the iframe code to embed the PDF stored in your Google Drive.
Here’s a detailed, step-wise guide on how to embed a PDF file in WordPress using Google Drive:
Step 1: Upload your PDF file to your Google Drive
To upload files to your Google Drive,
- Login into Google Drive.
- Select to New > File upload and select the file you want to upload from your local device.
Once you upload the file in your drive,
- Double click on the file to open it.
- Once it’s open, look for three-dot in the top-right corner. Click on the icon, and you’ll see an ‘Open in new tab’ option.
- You’ll again see a similar three-dot icon at the top right corner in the new tab. Click on it and select ‘Share’ this time.
- A pop up titled ‘Share with others’ will appear. Click on ‘Get shareable link.’ You can also specify whether to allow other users to either view or edit the file. You can adjust settings on who can view, edit, or print your file, using the ‘Advanced’ button on the bottom left.
- Click on ‘Done.’
Step 3: Embedding the HTML code
The final step involves finding the embed code and embedding it on your WordPress website.
- Just as before, click on the three dots icon in the top right corner.
- Select the ‘Embed item’ option.
- You’ll see a pop-up with HTML code. Copy the HTML code.
- Once you copy the code, go to your WordPress admin dashboard.
- Open the page/post where you want to place the PDF file.
- Switch to the text view and paste the code.
- That’s it. Publish or preview the changes and see how it looks.
2. Embed PDF Using Plugins
A somewhat more quick and easy way to embed a PDF file in WordPress is to use plugins. If you’re a beginner in WordPress, using a plugin is a better option than manually.
In the following section, you’ll find the best free plugins for embedding a PDF file in WordPress.
1. PDF Embedder
Adding PDF files and displaying them on your website is easy with the PDF Embedder plugin. This is one of the most flexible plugins for embedding PDF files in a WordPress site.
For navigating through pages, you have the Next/Previous button. Furthermore, some options allow you to add hyperlinks and download the files easily.
How to Use
- Install and activate the plugin.
- Click on ‘Add Media’ from any page or post. Instead of choosing an image file, choose a PDF file instead.
- In the editor, you’ll see a shortcode as below:
You can adjust the appearance, width, and Toolbar position through Settings > PDF Embedded.
2. Embed PDF Viewer
Another excellent option for embedding a PDF file in your WordPress site is to use the Embed PDF viewer. Unlike other plugins, this plugin allows you to embed PDF files from the Media Library and elsewhere on the web via oEmbed.
The plugin is compatible with the new block editor, and all versions of WordPress higher than 4.6. Likewise, it works great with PHP versions higher than 5.6.
Try out this free plugin and make the most out of it.
3. Google Drive Embedder
If you are likely to use Google Drive, we suggest you use the Google Drive Embedder. This plugin lets you access Google Drive using a popup where you can select multiple documents to embed in your post or page.
Once you adjust the sharing settings and allow anyone with the link to view the document, you can display the pdf on your website. Not just pdf, it works excellent with docs, zip files, videos, and images, etc.
There’s an enterprise version available that integrates deeply with WordPress giving you much more flexibility.
Here’s how this plugin works:
1. First, create and add a new post.
2. Embed the document you want to attach to the post.
3. Check how the embedded file looks.
4. Preview the post before you post it.
In the article above, we listed all possible ways and recommended plugins for embedding a PDF file in WordPress. So, if you have been wondering how to embed a PDF file in WordPress. Worry no more; simply read the article and follow the instructions thoroughly.