WordPress is a modern, flexible platform for publishing your website. One of the ways you can see this is though its approach to media. You’re able to upload almost all types to your site through the Media Library, but with some files, you need some extra support. If you want to learn how to embed PDF files in WordPress, you’ll need a few more steps than a simple image or video embed.
Because WordPress offers only generic embedding functionality, you’ll want to either use a server to host your files or install a plugin for most use cases. The good news is both of these solutions are suitable, and most importantly, simple to implement.
For this article, we’re going to show you how to embed PDF files in WordPress using both Google Drive, WordPress blocks, and a plugin. First though, it’s worth talking about why you’d want to embed PDFs, and point out the difference between a simple upload, and an embed.
Why You’d Want to Embed a PDF File in WordPress
You may already know why you’d want to embed a PDF file in WordPress, although you might not understand the benefits you’ll receive. There are plenty, and here are just a few:
- A PDF is great to use as a sampler for your full product or service. For example, if you’re a graphic designer or writer, you can make PDFs available for download.
- Some PDFs work well as reusable elements depending on the content. A signup form is a good example, or a terms and conditions document.
- If you commission white papers or reports, you won’t have to type them up into WordPress. Instead, you can offer the file for download or viewing.
The last point brings up a common use case for PDFs. For example, you might not want to recreate a valuable PDF as a post on your site due to the time-consuming nature of the conversion. However, you could embed the file and retain all of the dynamic and interactive elements of a native piece of content.
The Difference Between Embedding and Uploading Your PDF File
It might seem obvious to some, but there is a difference between embedding your PDF file and uploading it. Yes, you can upload any file to WordPress (apart from SVGs at current writing), but this doesn’t mean you can view it.
To do this, you’ll need some way for WordPress to ‘talk to’ the file in order to display it. This is where a dedicated PDF viewer comes into play. It used to be that WordPress was not the best when it comes to embedded files. However, with the advent of the Block Editor, you get a more consistent workflow more in line with other media types within WordPress – more of this later.
How to Embed PDF Files in WordPress (3 Ways)
There are three ways we’ll cover in order to embed PDF files in WordPress. Each one is going to suit different applications and workflows. As such, the one you choose is a personal decision:
- If you use Google Drive to host your files, you might want to add the embed code into WordPress’ HTML.
This article was written by Tom Rankin and originally published on WPKube.