Embed PDF into WordPress posts & pages

There are different ways you can upload PDF files to WordPress site and embed them straight into WP posts or pages. Many plugins can do that. However too many plugins will slow down your site. If you want to embed just a few PDF files to your site, a PDF embed plugin is not the best option. Today, we will introduce you two methods to add or embed PDF into WordPress posts and pages without any plugins.

Add PDF to WordPress just like adding images

PDF Thumbnail Previews is a new feature introduced in WordPress 4.7. This feature can help users manage their document collection in an easier way. When uploading PDFs, WordPress will generate thumbnail images automatically. So you can preview the PDFs through thumbnail images in WordPress Media Library. This helps you distinguish between all your PDF documents more easily. Meanwhile you can make use of the image versions of all PDF files in your Media Library and use them on your WordPress front site. For example, you can use the PDF images as feature images in WordPress posts, insert PDF images to WordPress posts and link them to the original PDF documents so your site visitors can open the PDF documents in their browsers or download the PDF from your WordPress site to their computer.

Make sure you have upgrade to WordPress 4.7 or later. Then go to upload the PDF docs from WordPress dashboard >> Media >> Add New, or go to Posts, find the post you like to insert PDF to, and edit it, then click Add Media to upload the PDF to your WordPress site. Once a PDF file being uploaded to your WordPress Media Library, you will get its URL address, such as http://www.betterhostreview.com/wp-content/uploads/2016/…/demo.pdf. WordPress will automatically create a jpg file with the same file name in the same directory as the original PDF document, in this case, it should be http://www.betterhostreview.com/wp-content/uploads/2016/…/demo.jpg.

To add the PDF image to WordPress post or page is easy. Click to edit the WordPress article, then click Add Media button above the article composing window, from the Insert Media pop-up dialogue, choose Insert from URL from the left panel, then paste the PDF image file to the box, and optionally add image caption, alt text, align and link to properties, finally click Insert into post button at the bottom right corner to insert the preview image of the PDF document into WordPress post or page. You can choose Custom URL in the Link To section to link the preview image of PDF to the actual PDF document, so you site visitors can get a clickable link to the original PDF file through the preview PDF thumbnail image.

What is the PDF preview thumbnail image too large?

Your WordPress theme may be able to automatically resize the image properly. Optionally, you can also specify a width and the correct height will be calculated automatically. For instance, if the source image is 800*600p, you can set the width to be 400p, then its height will be set to 300p automatically.

<img src=”http://www.betterhostreview.com/wp-content/uploads/2016/…/demo.jpg” width=”400″ />

The best way however would be using one of the generated fixed image versions of all PDF files in your Media Library. In fact, each PDF file comes with 4 image thumbnails in various resolutions. For example, if you uploaded a PDF file with the name of demo.pdf, you should find a demo.jpg and three other jpg images in different names, like demo-600×800.jpg, demo-300×400.jpg, demo-112×150.jpg. The size of the image thumbnails depends on your WordPress media settings, you can find and change them from WordPress Dashboard >> Settings >> Media >> Image Sizes.

Embed PDFs into WordPress posts via iframe

The HTML iframe tag specifies an inline frame, which is used to embed another document within the current HTML document. To add PDF to WordPress posts or pages and display the PDF in your WordPress site, iframe is an easy solution. To do that, you can copy below sample code into a WordPress post or page in the Text editing mode. Then adjust the value of width and height of the PDF, replace the URL with the absolute URL to your PDF file. Save the post or page and preview it to make sure the PDF displays in WordPress post or page properly.

<iframe width=800 height=600 frameborder=0 scrolling=auto src=http://www.betterhostreview.com/wp-content/uploads/2016/…./demo.pdf></iframe>

The documents and pages embedding via iframe however is an old way with its drawbacks. If you are not comfortable with any code, or you prefer a more easier way, you can scroll up and use the first method to embed PDF in WordPress using the PDF preview images.

Convert doc to PDF

PDF files are very user friendly. Your site visitors can open and view PDF files on their computers and mobile devices using a web browser, PDF reader or other compatible apps. If you have documents saved in other formats, you may also consider to convert them to PDF before uploading them to share on your site. For example, you can refer to this guide to convert Word doc to PDF using your iPhone. With a paper scanner app, even paper documents can be scanned to PDF using iPhone and other smartphones. This is very convenient when you want to digitize paper documents so they can be easily read and processed by a mobile phone or computer, and easily transferred and shared through the internet.

Leave a Reply

Your email address will not be published. Required fields are marked *