How To Embed PDF Files In WordPress (2023)

How To Embed PDF Files In WordPress (2023)

How To Embed PDF Files In WordPress (2022) - WordPress is a modern, adaptable website publishing platform. One way to see this is through

How To Embed PDF Files In WordPress (2023) – WordPress is a modern, adaptable website publishing platform. One way to see this is through its approach to media.

Also read: 2 Methods To Supercharge Your Website With Google AMP

You can upload almost any type of file to your site using the Media Library, but some files require additional assistance. You’ll need a few more steps than a simple image or video embed to learn how to embed PDF files in WordPress.

How To Embed PDF Files In WordPress (2023)

Because WordPress only provides generic embedding functionality, you’ll need to either host your files on a server or install a plugin for most use cases. The good news is that both of these solutions are appropriate and, more importantly, easy to implement.

This article will demonstrate how to embed PDF files in WordPress using Google Drive, WordPress blocks, and a plugin. But first, it’s worth discussing why you’d want to embed PDFs and distinguishing between a simple upload and an embed.

Why Would You Want to Include a PDF File in WordPress?

You may already understand why you’d want to embed a PDF file in WordPress, but you may be unaware of the benefits. There are many, and here are a few examples:

  • A PDF is ideal for serving as a sample of your entire product or service. If you’re a graphic designer or writer, for example, you can make PDFs available for download.
  • Depending on the content, some PDFs work well as reusable elements. A signup form or a terms and conditions document are good examples.
  • You won’t have to type up white papers or reports if you commission them. Instead, you can make the file available for download or viewing.

The final point brings up a common application for PDFs. Because of the time-consuming nature of the conversion, you might not want to recreate a valuable PDF as a post on your site. You could, however, embed the file and retain all of the dynamic and interactive elements of native content.

What Is the Difference Between Embedding and Uploading a PDF File?

Although it may appear obvious to some, there is a distinction between embedding and uploading your PDF file. Yes, you can upload any file to WordPress (except SVGs at the time of writing), but you can’t view it.

Also read: How To Fix ‘Another Update Is Currently In Progress’ WordPress Error

To accomplish this, you’ll need a way for WordPress to communicate with the file in order to display it. This is where a specialized PDF viewer comes in handy. WordPress was not always the best when it came to embedded files. With the introduction of the Block Editor, you now have a more consistent workflow that is more in line with other media types within WordPress – more on this later.

How to Include PDF Documents in WordPress (3 Ways)

We’ll go over three methods for embedding PDF files in WordPress. Each one will be appropriate for different applications and workflows. As a result, the one you select is a personal choice:

  • If you host your files on Google Drive, you may want to include the embed code in your WordPress HTML.
  • The WordPress Block Editor supports viewing PDFs, which may be all you need to display them on the front end.
  • A plugin like PDF Embedder will allow you to display your PDFs and provide readers with a full-featured experience.

The solutions we offer are not in any particular order, and none are more ‘correct’ than the others. As a result, examine each and select one that best suits your overall objectives.

1. Using Google Drive to Embed a File

Many website owners use Google products, and those who are invested in the ecosystem understand how important Google Drive is.

Also read: How to Check and Update PHP Version WordPress

If you host your PDF files in the cloud and don’t want to move them, you can easily embed them into your WordPress website. To begin, navigate to your desired file within Google Drive and select the Share option from the More actions menu.

You are free to select whichever combination of settings best suits your needs. Return to the More actions menu and open the file in a new window once you’ve finished here.

You’ll notice that the menu’s options change. There is now an Embed option in the More actions menu.

When you click this, a dialog box will appear with some HTML code. You should copy this and then return to WordPress.

You can now return to WordPress and open the page where you want to embed the PDF. Open the Code editor this time from the Block Editor’s More actions menu.

Your task here is to locate and paste the appropriate embed code.

When you click the Exit code editor link, the embed will appear on the page.

However, while this is a quick way to implement, it is a functional way to display your PDF because it is an iframe with few options. Continue reading for a more adaptable approach!

2. Using WordPress Blocks to Add a Viewable PDF File to Your Site

Unlike the old Classic Editor, the Block Editor allows you to work with various media types in a consistent manner. This is most noticeable when you embed PDF files in WordPress.

Also read: 20 Best HTML Web Fonts (2023)

The File Block can be used to embed any type of file, but in this case, we’ll use it to embed a PDF. If you navigate to your desired post or page, you can search for the File Block, which will display a file uploader dialog (similar to images).

If you add your file here, it will appear as an inline element in a nice-looking viewer.

You’ll also see your file’s full URL path and a Download button. You can change this in the dedicated Block settings in the editor sidebar.

It’s a better solution than a Google Drive embed in our opinion, but it still only provides a light experience that can be improved with the use of a plugin. Let’s go over this option next.

3. Using WordPress Plugins to Embed PDF Files

If you want to regularly embed PDF files in WordPress or provide a high-quality reading experience, a plugin is the way to go. There are several options to consider, and in reality, any of them will provide a satisfactory solution.

Also read: WordPress Memory Limit: How To Fix PHP Memory Limit

However, we like PDF Embedder because it has a large number of installations, a large number of positive reviews (indicating that other users enjoy the plugin), and it receives regular updates.

After installing and activating the plugin, navigate to the WordPress Settings > PDF Embedder page.

There aren’t many because the viewer looks great right out of the box. However, you can alter elements such as the minimum and maximum dimensions, as well as some toolbar-specific settings.

Simply add a PDF Embedder Block to your content and select your PDF file from the uploader to embed it.

You can also check out the Block settings here and make changes as needed. If you didn’t make any changes to the global settings earlier, you might want to do so now.

However, this will provide you with a potentially superior viewer than Google Drive’s embedding or the native WordPress option. Furthermore, you can upgrade to a premium version of PDF Embedder to gain access to additional features, a higher level of support, and much more.

How to Embed PDF Files in WordPress that are Readable and Optimized

You should optimize your PDF files in the same way that you would your images and videos. Here are a few quick tips for serving small files that look great and retain their richness:

Also read: How To Install WordPress Locally (2023)

  • Your typography is as important as the typefaces on your website. We recommend using no more than two fonts at a size that is comfortable for all eyes.
  • PDFs can be optimized in the same way that images can. A PDF can be several megabytes in size, so make it as small as possible. ShortPixel has a fantastic PDF compressor in addition to its crushing image optimization.
  • Also, if you include images in your PDF, make sure they have the appropriate level of optimization.

In general, treat your PDF as you would a blog post or website page: Make it search and speed optimized, and don’t worry about interactivity. The file will render properly and have the same dynamics as native content.

Summary

You’ll be able to work with whatever media you throw at your WordPress website (SVGs withstanding). When it comes to PDFs, WordPress has an excellent native experience that may be all you require. There are, however, other considerations you can make if you want a more full-featured experience when embedding PDF files in WordPress.

Also read: How To Fix Installation Failed: Destination Folder Already Exists

If you host your files in Google Drive, for example, you could ‘hard code’ the embed HTML into your content. This will provide a nice viewer, but it is not flexible and may result in broken links and missing media if the file is removed later. Instead, a plugin will provide you with all of the functionality you require. PDF Embedder is fantastic, but there are other options. The task at hand is to choose the best one for your requirements and workflow.

ExplainWP
The WordPress Learning Hub

Related Posts