PDFObject is a JavaScript utility I created in 2008 to embed PDFs in HTML documents. It was modeled on SWFObject.

Three years have passed since PDFObject 1.0 was released, and the browser landscape has changed dramatically. I figured it’s time to dust off PDFObject and see if it can be improved and/or updated for today’s browsers.

I’ve placed a modified edition of PDFObject (version 1.1) on GitHub as an open-source project, allowing anyone to create a fork and make modifications. There are also a handful of example/test HTML files there, too. I could use some help testing the examples in different OS/browser combinations, and with different PDF plugins.

If you have suggestions for improvements, or have a few minutes to test PDFObject examples in your browser/OS of choice, I’d be grateful to hear from you. Just leave a comment below, or send me a message on twitter. So far I’ve only performed some cursory tests in Firefox 3.6 in OSX 10.6.6, but everything seems to work as expected.

https://github.com/pipwerks/PDFObject

I plan to update PDFObject.com soon, too.

Similar Posts

12 Comments

  1. I just found this and it’s great. Working good for me in Firefox/Safari/IE, but it’s having problems in Chrome. Can’t zoom set for the PDF. It’s always at 100%.

  2. @philip Ah, it’s because Chrome is using it’s own PDF Viewer plugin by default instead of the Adobe plugin.

    about:plugins and disable Chrome PDF Viewer

  3. I found out your plugin yesterday, we are looking for a good way to show PDF on a website and it seems like there’s no good solution. I’m my search I found out that tag is getting back with HTML5 and it seems to be better than , what do you tink of this? Maybe you could improve your plugin so that if browser support HTML5 it render a embed tag? I’m on Win7 and it works fine everywhere except on firefox4, it just don’t work with object, even the alternate html with the link does’nt get rendered. But if I trywith embed in FF4 it works.

    What’s even stranger is that with youre plugin it works, it’s just when I write it by my self. Anyway I’m interested about what you think of HTLM5 and I also like to know what’s the advantage of using the plugin vs HTML?

    Thanks!

    1. @vincent yeah, firefox requires you to specify the height of the object’s parent container via CSS or else your object’s height will seem broken.

    1. @andrew PDFObject includes support for the PDF mime type (not just Adobe Reader) so it should support Chrome’s PDF Viewer. However, Chrome’s PDF Viewer is very new, so I haven’t performed any tests to confirm functionality. I’ll certainly look into it, but I have no timeline at the moment.

      1. I’ve done some quick testing in Chrome (12, Mac OS X) and can confirm that PDFObject works as expected. However, Chrome does not support PDF Open parameters, which means you can’t script the toolbar to show/hide, or script the PDF to show a specific search term. This functionality is completely controlled by the PDF viewer (in this case by Google Chrome) and is not a bug in PDFObject.

  4. Hi Philip.
    While using PDFobject viewer i have discrepancy in disabling the toolbar option especially in google chrome browser. Can you please look into the matter @ earliest.

  5. Hey Phillip,

    First off, I love your PDFObject Script. It’s awesome. However, I am having trouble trying to make my PDFObjects dynamic by passing a parameter from an xml file into my function, which then embeds a PDF by the name of said parameter.

    Here is a sample of my code:

    function set_skins(datas) {
    var temps=document.createElement(“DIV”);
    temps.innerHTML=”{url: ‘” + datas +”.pdf’}”;
    var myPDF = new PDFObject(mebbe).embed(“skins”);
    }

    Where ‘datas’ is the name of the file (without the ‘.pdf’) that is passed from my xml file into my function, which I would like to embed.

    I’ve been searching for work-arounds, but to no avail thus far. I’ll continue to search, but any assistance or direction would be much appreciated.

    Thanks for everything!

    -Mike

Comments are closed.