Websites related to tours and travels, dealing with eBooks, course materials and restaurant-based sites need to embed a pdf file to display their content.
By default, WordPress does not allow you to embed files directly. You can upload a pdf file in a page/post through the Add File block, but this built-in method just provides a link of the uploaded file. Your visitors have to either download the file or view it in a new browser tab. This affects the site’s pageviews and user engagement.
But what if you want to embed the pdf files in your website just like the images, videos and audios? How can your user’s directly view the pdf files without leaving your website?
In this article, we have explained two methods through which you can embed pdf files in your WordPress website.
Method 1: Using WordPress Plugins to embed PDF files
With the help of WordPress Plugins, you can easily embed PDF files to your WordPress website. This is the quickest and most efficient method for WordPress beginners. There are multiple plugins available in WordPress to embed the PDF files.
Plugin 1. PDF Embedder
First, you need to install and activate the plugin in your WordPress website. Go to Plugins >> Add New and search for “PDF Embedder”. Click on Install now, then Activate the plugin.
Upon activation, Go to Settings >> PDF Embedder to modify the plugin settings. You can customize the plugin under the Main Settings tab.
PDF Embedder displays the pdf at their original size. If you want to change the PDF size, you can specify Width and Height in the text fields. Also, you can decide the position of the Toolbar and its visibility. Using the Toolbar your users can zoom in/out of the pdf and toggle between the pages. Select whether you want to permanently display the Toolbar or it just appears only when the user hovers over the document. Don’t forget to click on Save Changes at the bottom of the page.
Now, to embed a PDF file in your WordPress page or post, go to your Block Editor. Click on the + button and select the custom block PDF Embedder.
Click on the block to open the Media Library and upload the file. Select the PDF file from the Media Library. You can preview the pdf in the frontend of your website and then Publish your Page/Post.
The PDF Embedder Premium version has extra features such as:
- Continuous scrolling between pages
- ‘Download PDF’ button allows users to obtain the PDF to read in their own choice of viewer
- Full screen button
- Fully functioning hyperlinks
- Jump straight to page by typing page number
- Track number of views and downloads
OTHER PLUGINS (OPTIONAL)
Plugin 2. PDF Viewer for WordPress
Plugin 3. Google Drive Embedder
Plugin 4. Algori PDF Viewer
Method 2: Using Google Drive account and iframe code to embed that file.
You can upload the PDF file to your Google Drive and then embed the file to your website using iframe code. This is a secure method to embed pdf without installing a plugin.
Upload the PDF file to an existing Google Drive or create a new account. You can sign up for a free Gmail account to get 15GB of Drive space. After you Log in to the Google Drive account, Select New >> File upload and browse the file you want to upload from your device.
Preview the uploaded PDF file in your google Drive.Then in the top right corner of the page you will see three vertical dots i.e More actions, Click on it and select Open in the new window.
In the new window again select the three vertical dots >> Share and click on Change to anyone with the link in the ‘Get Link’ pop up. Now, anyone with the file link can view the pdf. Click on Done once you get the following confirmation.
Now to embed the pdf, again click on the three vertical dots and select Embed Item
Copy the iframe code to embed the PDF file in your website.
Now, Edit the page/post where you want to embed the PDF and paste the iframe code using Custom HTML Block.
Preview to check out how the PDF will appear on your website and click on Publish.
We hope this article helps you to embed pdf files to your WordPress website. In case of queries, please leave a comment and we will get back to you as soon as possible.
Also, if you want us to cover a specific topic you can leave a comment for that as well.