how to embed pdf files in wordpressIn the last few days, three people have asked me how to embed PDF or other documents in WordPress Posts. So, I decided to write a post showing how to do it.

You will be surprise how easy it is!


How to Embed Google Docs in WordPress

WodPress will use an iframe to display those documents, so the only thing you have to do is to get this code and paste it into the post or page where you want the documents to be inserted.

Don’t worry about how to get the code, Google Docs will give it to you. Let’s see a step-by-step demo using a Google Docs Spreadsheet. The process is very similar for other types of Google Docs.

Step 1. Open the Google Doc you want to embed and set its privacy to “Public”. To do it, click on the “Share” button in the top-right corner of the screen.

embed google docs in wordpress

Step 2. Choose “Publish to the Web” from the File tab in the top menu.

google docs wp

In the new pop-up window, choose the sheets you want to embed and click the “Start Publishing” button. In the drop-down menu below, choose “HTML to embed in a page”. This will generate the code you need.

embed spread sheet in wordpress

Copy the code from the box and paste it into the post or page where you want to embed the document. Remember to do it in the HTML view.

google docs embed code

And… voila! Your spread sheet is now showing in your Post.

How to Embed Office or Similar Files in WordPress

If you don’t want to embed a Googel Doc but a file from Office or other similar programs, using a plugin is the fastest and easy way to do it.

There are several WordPress plugins that can do the job, but I’m going to show you how to do it using Google Doc Embedder Plugin.

And we are! Do not let the name of the plugging confuse you. What that plugin does is embedding self hosted files such us Excel Spread sheets or PDF documents using the Google Docs viewer.

To use the plugin, download and install it. Then, go to the plugin’s Settings Panel (under “Settings” in the left sidebar of your Dashboard) and configure it. The configuration options are very straightforward; so, I’m not going to go through them.
google docs embedder pluggin

You are now ready to embed your documents into your WordPress posts or pages. To do it:

  • Upload the document to your server.
  • Go to the post/page where you want to insert the document. You will see a new icon in the Post Editor.

google docs pdf wp

  • Click on it and a pop-up window will appear. Enter the URL of the file you want to enter in the first field. The rest of the fields are optional. You can use them to override the default options you set up in the plugin’s configuration panel for this specific document.

wp google docs embedder settings

You can also use the shortcode below.

[ gview file="http://full-path-to/" ]

NOTE: Please, remove the extra blank space after and before the brackets. I have pace it here to cancel the effect of the shortcode.

How to Embed PDF files in WordPress

You can also use the Google Docs Embedder Plugin to embed PDF files. (If you have not read the section above, please, do it to see how). That’s the most straight forward method. However, there are other alternatives.

embedding pdf files in wordpress

Nor really… If you use this function to insert the PDF file, you will only insert a link to the document, not embed the document itself.

The first alternative to actually embed the PDF file into your post or page  implies using a third part service such as Scribd.

To do it, upload the document to Scribd and then use the embed code it gives you. To get the code, click on the “Embed” button on the right and, in the pop up window, choose “” format . Copy the code and paste it on you post.

The second alternative is to upload the PDF file to your server and place the following code in the HTML view of your Post editor.

<embed src=”” width=”500″ height=”375″>

Set the width and height to the desired size.


Now you only need to choose the method you like better and implement it. All of them work well; so, which one to use is a matter of preference.

If you have any question or suggestion, please, add it  in the comments bellow!