Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
Advertisement
  1. Code
  2. WordPress
Code

How to Embed and Protect PDF Files With a WordPress Plugin

by
Difficulty:BeginnerLength:MediumLanguages:

PDF files are a very popular way of sharing formatted documents due to their flexibility and lightweight nature—they work on most devices and operating systems. In this post, I'll show you how to use a plugin to embed and protect PDF files in your WordPress posts and pages.

Why Use PDFs?

PDFs can be used by all kinds of business, whether you want to display a catalog for your properties or show menu items for your restaurant.

Some of the advantages of using PDF files are:

They Provide a User-Friendly Experience

When displaying information on your web pages, you should also think about how your users will consume it. While they're not as accessible as including information directly in HTML, PDF files provide a more friendly experience than other file formats. For example, not everyone will be able to open a Word document!

Information Privacy and Copyright Protection

PDF files provide the ability to deny copying or printing. This is important when you need to protect intellectual property.

Content Can't Be Easily Changed

A PDF file provides a way for users to interact with a document without changing the content. For example, people can digitally sign the document without being able to change the content.

Universal Accessibility

You can read a PDF from any device and in any language. The original version is always the same, regardless of the number of times it is shared. 

When Should Your Website Use PDF Files?

Below are some instances when you should use PDF files:

  • To provide access to content that already exists in printed form.
  • To reduce the size of a document. For example, you might have a presentation that requires compression.
  • For printing content such as books, manuals, catalogs, or similar publications.
  • For very long text or graphic content. People prefer to download a long document rather than read it in the browser.
  • To restrict access to content. Restricted content is better delivered via a PDF since you can employ measures such as password protection or encryption.

Getting Started

PDF Viewer for WordPress is a fully responsive plugin that allows you to embed PDF files in your WordPress posts and pages. It also allows you to enable or disable printing, downloading, zooming, and social sharing.

Let's start by downloading the plugin from CodeCanyon. If you have an account already, you can purchase the plugin from the product page. If you don't have an account, you can create one from the signup page.

Once you purchase the plugin, you will get a link to the files. Alternatively, you can find them in the download section of your account with your other purchased items.

You will then need to log in to your WordPress site, go to Plugins > Add New, and upload the provided zip files. After uploading, click Install Now, then wait a few seconds and click Activate. You can now start using the plugin.

Features of PDF Viewer for WordPress  

PDF Viewer for WordPress is the perfect way to display your PDF files on your WordPress site. It is fully responsive and compatible with major browsers. Other features include:

  • Tracking with Google Analytics: This feature allows you to track the number of visitors who have read your PDF using Google Analytics.
  • Personalization of your files with your logo or branding. You can also enable and disable tools such as Find, Download, Share, Email to Friend, Page Navigation, Zoom, Print, and others.
  • Unlimited PDFs and sizes: This plugin allows you to embed an unlimited number of PDF files of different sizes.
  • Supports up to 100 languages.
  • Support for sharing PDFs on social networks

How to Embed a PDF File in a Post or Page

Once you install the PDF viewer, it will appear on the left side of your admin menu as shown below.

PDF Viewer menu in WordPress admin

We will start by uploading the PDF file we want to display on our page. PDF Viewer for WordPress comes with an upload feature that lets you makes the upload process easy and seamless. You can upload a PDF file from your library or from an external source and then obtain a URL to the document on your server. 

Simply follow the following steps:

  • Go to the Upload PDF File option.
  • Click on the button labeled Click here to upload the PDF file.
  • An upload dialog will pop up where you will be prompted to choose your PDF file.
  • Once you choose or upload the file, you will see a Get Link button, which you will be able to click on to obtain the URL for the PDF file.
  • You can copy this link and use it to embed the PDF anywhere you like in your posts or pages.

Paste this link into a post or page to embed your PDF, which should appear as shown below once embedded.

Embedded PDF

How to Import a PDF File to a Post or Page

PDF Viewer for WordPress also provides the ability to import a PDF file from any URL. The process is similar to the upload method we looked at above.

  • Go to the Import PDF File panel.
  • Paste the link to the external PDF in the space provided.
  • Click the Import button.
  • You will then get a URL which you can use to embed your PDF anywhere you wish.

Customize the Viewer Look

PDF Viewer for WordPress also lets you customize the look of your PDFs and viewer. Click on Customize Look and choose a theme or use a custom color as your theme. You can also change the text color on the toolbar as well as style icons.

PDF Viewer for WordPress Customize Look

How to Protect PDF Files

If you want to protect your files from being downloaded by everyone, there are a few measures you can use to ensure that your content is only accessible to permitted persons.

In this section, I'll show you how to use password protection to protect your content.

Password Protection for PDF Files

Password-protected pages allow you to hide information from users unless they have the password. It's easy to set up password protection on posts and pages.

To protect a post or page using a password, simply follow the following steps:

  • Go to the post or page that you wish to protect.
  • Right under the Publish button, change the visibility to Password Protected.
  • Enter the password and hit Publish.
password protecting a post

The post or page should now prompt you for a password when you view it.

Password protection prompt

Other Ways of Protecting PDFs

Apart from private access and password protection to pages and posts, there are other advanced ways in which you can protect your PDFs. These include:

  • Membership and Content Restriction plugins: These types of plugins provide you with the ability to lock or restrict content access to premium members.
  • Expiring URLs: This involves setting a certain period within which users can access your content via a given link. Once that time elapses, the link is no longer valid.
  • Use of Content Protection plugins: There are a number of plugins available at CodeCanyon that allow you to protect images, text, posts, and pages as well.

Another alternative for protecting PDFs is setting a document open password. A document open password requires a user to type a password in order to open the PDF. Most financial institutions use this method when sending out statements since each password is unique to each user.

Once your PDF is password protected, you can embed it into any page or post. This ensures another layer of security for your PDFs.

Additionally, you should also ensure that Google doesn't index your PDFs. You can do this using the Yoast WordPress SEO plugin.

Conclusion

PDFs are very popular on modern websites. Whether you want to display a product catalog, flyer, or invoice, PDFs are the most likely format to be used. They provide a seamless experience for your users, by ensuring every user can read your content regardless of which device, browser or language they are using.

Also, if you want to use custom plugins but you're not comfortable tinkering with servers and prefer to have someone do it all for you, consider managed WordPress hosting. Thanks to Envato's partnership with SiteGround, you can get up to 60% off managed WordPress hosting.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.