WordPress.org

Ready to get started?Download WordPress

Plugin Directory

vanilla-pdf-embed

Embeds PDFs in your pages and posts, without using JS.

Basic use

To embed a PDF you've uploaded to your WordPress site's media library, simply put the URL for the attachment page in your post on its own line. The PDF will be embedded with the default settings at that location, as if it were using oEmbed.

Examples:

Post short URL:

http://localhost/?p=9

Attachment default URL:

http://localhost/?attachment_id=9

Attachment pretty URL:

http://localhost/test/report1/

Media direct URL:

http://localhost/wp-content/uploads/2013/11/report1.pdf

This doesn't work for PDFs hosted on other websites, or if you need to change the parameters.

Using the [pdf] shorttag

If the PDF isn't in your WordPress site's media library, or if you want to customize any parameters for the embed, then use the [pdf]...[/pdf] shorttag. Between the tags, you'll provide the URL for the PDF to embed. If the PDF is in your WordPress site's media library, you can either give the attachment page URL, or the URL to the PDF file directly.

The [pdf] shorttag accepts several optional parameters:

  • width - sets the width of the frame the PDF is embedded in. By default, this is set to 100%.
  • height - sets the height of the frame the PDF is embedded in. By default, this is unset.
  • title - sets the title of the PDF, for use in the fallback link text.

Examples:

Post short URL: [pdf width="200px"]http://localhost/?p=9[/pdf]
Attachment default URL: [pdf height="500em"]http://localhost/?attachment_id=9[/pdf]
Attachment pretty URL: [pdf title="Report 1"]http://localhost/test/report1/[/pdf]
Media direct URL: [pdf]http://localhost/wp-content/uploads/2013/11/report1.pdf[/pdf]
Compatibility

The PDF should be embedded in the page, with the document scaled so it fills the embed frame horizontally. Unfortunately, embedding PDFs is not well-supported.

PDF open parameters

The PDF should be scaled/zoomed within the embed frame so that the full horizontal width of the paper fills the frame. This is not supported in Chrome's default PDF viewer, so the document will probably be scaled to 100%, which may either mean the document doesn't fill the frame, or, more likely, the document is too wide for the frame, and the right-hand side of the document is hidden.

There is currently no way to customize the PDF open parameters.

Mobile browsers

In particular, mobile browsers may show a grey box instead of the embedded PDF, and will download the file when it is clicked. Other mobile browsers might embed the PDF, but won't allow it to scroll.

Tags: ,

Requires: 3.0.1 or higher
Compatible up to: 3.9.0
Last Updated: 2014-5-4
Downloads: 17,147

Ratings

4 stars
4.9 out of 5 stars

Support

4 of 5 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1
100,2,2
100,3,3 100,1,1 100,3,3
100,1,1