How to Add PDF Viewer in WordPress – Learn WordPress from a to z

Tutorials 0 lượt xem
How to Add PDF Viewer in WordPress - Learn Wordpress from a to z thumbnail

The PDF format is suitable to use when you want your files to always have the same layout, no matter what device they are viewed on. By embedding a PDF file in WordPress, you can share your file while keeping visitors on your site.

In this article, I will show you how to add a PDF viewer in WordPress.

Why do you need to add a PDF viewer in WordPress?

Normally, WordPress doesn’t embed PDF files in blog posts like it does with audio, video, tweets, and other media formats. It just adds the file as a downloadable link.

That means your visitors will have to leave your post to view the PDF. They probably won’t come back to your site, and this reduces pageviews on your site.

pdf view

One way to get around this is to offer PDFs as a content upgrade. You can ask users to sign up for emails with your website to receive rewards.

However, if you just want users to view PDFs without leaving the page, then you’ll need to add a PDF viewer.

How to install and set up PDF Embedder

I recommend you to use PDF Embedder plugin . It uses JavaScript to embed files with a fully functional toolbar that allows users to zoom in and navigate the PDF file.

First, you need to install and activate the PDF Embedder plugin.

Upon activation, you can visit Settings » PDF Embedder to configure plugin settings. The default setting is suitable for most websites, so this step is optional.

install pdf embedder

Settings allow you to control the height and width of the PDF viewer. You can change this if you feel the PDF viewer is not suitable.

You can also choose to show the toolbar at the top or bottom of the viewer and hide it until the user hovers over the document.

Once you’re done customizing your settings, don’t forget to click the ‘Save Changes’ button to store them.

Now I’m ready to embed a PDF file in a WordPress post or page. Here I will guide you to do that using Classic Editor.

How to add a PDF viewer in Classic Editor

Embedding PDFs into Classic Editor is just as easy. Start by adding a new post or opening the post you’re working on. 

Then you should place the cursor where you want the PDF to be displayed and you need to drag the PDF onto the page. When you see the message “Drop files to upload”, you can release your mouse button.

embed classic editor pdf file

The PDF will be automatically uploaded to your media library and selected. All you need to do now is click the ‘Insert to Post’ button.

select pdf classic editor

PDF Embedder will add a shortcode to your post or page. It should be something like [pdf-embedder url=”PDFURL”]. This will display the PDF file when you preview or publish it.

code code pdf classic editor

To view a PDF, simply save your post and preview it on your live site. This is how it appeared on my demo site.

pdf interface

Epilogue

With the above guide, I hope to bring convenience to your users.

If you find it interesting, you can follow the  basic WordPress section  to know more new knowledge.

Follow fanpage to receive the latest posts:  Group

Bài viết liên quan