21 Jul

I threw together this quick Google Gadget, because there was no existing gadget to embed a PDF that was saved in my Google Drive onto a Google Sites.

I was working on a project for a client who needed an easy way to do this.  I thought for sure I could just use the native Google Sites functionality of “Insert > Drive > Document”.  But if you try to embed a PDF using this, you get an error that says “The URL you entered is not supported.”

Screen Shot 2014-07-21 at 5.27.12 PM

So, after a little bit searching, I found this post about how to embed a PDF without the left side preview pane (while useful, its annoying for embedding).

A quick glance at the Google Gadgets documentation and I whipped up this gadget that is reliably working.  Feel free to use, copy, and modify to your heart’s content.

Here is the link to the gadget:
Embed a PDF Document on Google Sites from your Google Drive
And here is the URL for copy/pasting:

http://ejimford.com/gadgets/embed_pdf_google_sites_drive.xml

Update: I’ve updated the gadget so that you can now use the FULL URL of the PDF on Google Drive. You no longer have to isolate the Document ID from the URL of the Google Drive PDF. Should make things much easier and a bit more dummy-proof.

I’m leaving the old version above, for those that prefer it. But most people should now use the following information.

Link to the Gadget:
Embed a PDF Document (Full URL) on Google Sites from your Google Drive

And here is the URL for copy/pasting:
http://ejimford.com/gadgets/embed_pdf_google_sites_drive_url.xml

Here are the instructions for how to use the gadget:

  • Go to your page on Google Sties and click the edit button.
  • Click on the Insert -> More Gadgets

more-gadgets

  • On the left side of the popover, click on “Add Gadget by URL”
  • Paste the URL above into the text box

add-gadget-by-url

  • Enter the Document ID (Update: OR THE FULL URL. See above.) of your PDF into the relevant text box and make of the standard Gadget formatting changes.
  • When you save the page, you’ll see the PDF embedded on the page.

Enjoy!

35 Responses to “Gadget to Embed a PDF from to Google Drive to Google Sites”

  1. dl

    Just wanted to say thanks!! for creating and sharing your gadget. It worked great.

  2. E. James Ford

    Hi, Mario! Two answers for you:

    1) The document ID is in the URL of the PDF on your Google Drive. If you click the screenshot above, you’ll see the document ID highlighted. (Here’s the link to the URL)

    2) I actually created a newer version of the gadget that makes it so you don’t have to isolate the Document ID…. You can just copy/paste the full URL of the PDF. I’ll update the post now to add the link to that new gadget.

  3. Raanan Kesar

    Hi,

    I’m able to get the gadget but for some reason I’m getting a “Apologies. There is no preview available.”

    What am I missing?

  4. E. James Ford

    Thanks for this, Raanan. It looks like a few days ago (around November 11, 2014) Google made an unannounced update to their Document viewer so that it breaks the plugin. This has broken a TON of different tools around the web.

    I won’t be able to work on a fix for this until early next week… So I’ll ask you to bear with me. I’ll update in just a moment and hopefully have a fix by next week.

  5. Dean

    I really appreciate your plugin and your willingness to update it. Thanks!

  6. Laura

    This is awesome – and your quick replies equally as well. Thanks so much for helping with Google Sites and explaining what it going on with the broken plug-in.

  7. Dean

    Hi James, I wanted to let you know that Google now offers a way to embed PDFs (and many other Google docs) in much the same way your gadget worked. While editing a page, you go to the menu Insert > Drive > Document and paste the share link there. Works great. Thanks for writing the gadget before though, it was nice to use for the past few months.

  8. Laura

    Thank you Dean!! This saved me – 60 PDFs due next week! ” )

  9. Daniela

    After trying soooo many options this is the only one that actually works!!!! Thanks!!!!!!!!!!

  10. Eileen

    Great gadget! I have used it twice and it works really well! My only issue is that each time I use it, I have to get the URL (saved in a doc). Is there any way to save that gadget in the list of gadgets or search for it and find it? Hoping to be able to copy and paste the link to my doc first, then quickly add. Thanks again!

  11. Jill Fay

    Super handy. My class is making eBooks using Google presentation and now we can publish them in true eBook form. Thanks a LOT. It works like a champ!

  12. Rakesh Ranjan

    Thanks for share good content. it worked.

  13. Breck Jacobs

    Just what I needed Mr. Ford. You have saved me some grief by providing this cool pdf gadget. What I don’t understand is why google hasn’t provided this option as default, when using sites.

  14. Rick Juliano

    Much appreciated James. Worked great! I appreciate you also leaving out the usual pdf viewing tools so the pdf fills the frame.

  15. Sati Shankar

    Thanks for your contribution, it is simple, quick and nice.
    How to remove extra shaded sides so that doc fits to the frame.
    As an author i want a fit solution, as I myself work for my website.
    if needed I can pay for your help.
    Regards
    ss

  16. Craig

    Hi James.

    Im curious as to whether using this method means we are dependent on http://ejimford.com remaining available. When embedding the PDF, does Google save your xml code, or does Google refer to http://ejimford.com each time the PDF is accessed?

    Thanks
    Craig

  17. ejimford

    Right you are, Craig. if you just use the gadget that is hosted on my site, it does require my site to remain active and available. however, I don’t have any plans for my website to go anywhere. And if you are are concerned about that (understandably), then you can always download the XML gadget and host it yourself somewhere by right clicking, saving the gadget to your desktop, and uploading to your own server. The gadget is free to do with whatever you like.

  18. ejimford

    How to remove extra shaded sides so that doc fits to the frame.

    Hi, Sati! Sorry it took me a bit to reply to your question. I’ve been buried in other projects.

    Unfortunately, I don’t think this is possible, as I haven’t found a way to pass a Zoom variable in the URL. There IS a Zoom button that appears for the user so they can zoom in themselves… But it does require them taking that action.

    If anyone knows of an answer to this, I’d like it too!

  19. Lorenzo

    Great gadget to embed a PDF from to Google Drive to Google Sites. I like that really

  20. Aaron Eling

    Easy solution after many failed attempts, thanks!

  21. John Helsley

    Couldn’t get any other gadgets to work, until this one. Worked first time!

    THANKS

  22. alkesh zaveri

    u rock it sir . ur gadget helped me a lot and worked great .. thanks a ton..

  23. Tim Carter

    Thank you E.James Ford for this gadget. Made life a lot easier. Even worked when Steegle’s solution didn’t!!

  24. Melanie R.

    Just what I needed! Thanks so much for the succinct, clear directions, for your time and effort to put this together initially (as well as updates), and for your willingness to share it.

  25. Thùy Vân

    Wow, thanks so much!!!
    It’s so easy to do and works well!

    I just have a quick question, how would you modify the gadget so it allows 2-pages view option?

    Thanks,

    Vân

  26. ejimford

    Unfortunately, the Google PDF Viewer doesn’t allow a 2-page view at all, so there’s no way to do this. Single page and scrolling only. 🙁

Leave a Reply