WordPress comes with tons of plugins basically you can easily find multiple plugins for almost every requirement or problem. But, using plugins for every single requirement is not what we recommend at techinfoBiT; installing so many plugins can affect the website’s performance and security. We have fixed several issues where the WordPress plugin exposed the website’s security, sometimes even popular plugins with millions of active downloads got compromised. So unless it is really necessary, we should avoid the additional plugin installation or customization in WordPress.
There are multiple free and premium plugins which can be used to embed the PDF in any page and post of the WordPress website. These plugins are useful in many ways especially when you are going for the premium version of the plugin; it may serve the custom requirement very well. However, if you are looking for a quick-fix and easier option to embed PDF without doing any additional installation try embedding the PDF from Google Drive.
How to Embed PDF from Google Drive?
Embedding PDF from Google Drive is the easiest way to add PDF on any WordPress website, it won’t require any additional plugin installation and it will also save your server storage since files will be served directly from Google Drive. The steps are as follows;
- Login to your Google Drive account.
- Upload your PDF file to Google Drive.
- Right-click on the PDF and select Share.
- Go to the General Access section Click on down-arrow and select “Anyone with the link”
- Click on ‘Done’
- If you want to restrict the Download, Print etc then Click on the Setting icon and uncheck the respective options.
- Now, right-click on the PDF file in Google Drive and select “Preview” to open it.
- On the next screen, click on the dots at the upper right corner to show a menu and select “Open in new window”.
- In the new window, click again on the upper right-corner dots to show a menu.
- Select ‘Embed item…’
- On the next window, it will show you the HTML embed code, Copy the code.
- Go to the WordPress page or post where you want to embed the PDF file, make sure you are editing in the “Text” mode and then Paste the Code.
- If you want you can adjust the ‘width’ and ‘height’ of the iframe, in case you want to add multiple PDFs you can use the same code and just replace the URL; make sure the file is accessible by anyone with the link.
- Continue editing your post and once editing is done click on “Preview” to preview the post and ‘Publish’ to publish the post/page.
Example: I have embedded a dummy PDF file in this post for reference, I have used the following code to Embed the PDF file directly from Google Drive.
<iframe src="https://drive.google.com/file/d/14ULoRd0fbkjh6AQCaO8CkKEM29tllWCM/preview" width="640" height="480" allow="autoplay"></iframe>