views:

1814

answers:

3

When I upload PDF to Google Docs (using Python's gdata library), I get link to the document:

>>> e.GetAlternateLink().href
Out[14]: 'http://docs.google.com/a/my.dom.ain/fileview id=<veery-long-doc-id>&hl=en'

Unfortunately using that link in IFRAME is not working for me because PDF viewer is redirecting to itself, breaking out of IFRAME.

Looking for the solution, I've found this: http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html - which looks very nice, but I can't find a way to use it with document uploaded to Google Docs. Does somebody know how to do it/if it's at all possible?

+2  A: 

Just for the record - I haven't found any way to force "internal" google google pdf viewer to not go out of iframe. And as I mentioned in quetion, I found this nice standalone viewer: http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html, that can be used in this way:

  <iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&amp;embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>

-- but in order to use it you have to publish you PDF to the outside world. This wouldn't be bad solution, because published document has unique id that is probably harder to guess than password to google docs account. Unfortunately, even with hottest Google Docs API version 3 API, there seems to be no way of programatically publishing PDF..

In the end, I went for mix of standalone PDF viewer from google and some other web service that allow to programatically upload and publish PDF. A bit half-baked solution, but it's working well so far.

Tomasz Zielinski
A: 

To embed pdf files present in your google docs into your website use the below code:

<iframe src="http://docs.google.com/gview?a=v&amp;pid=explorer&amp;chrome=false&amp;api=true&amp;embedded=true&amp;srcid=&lt;id of your pdf>&hl=en&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
Deepak Yadav
It doesn't work. It says the document isn't available.P.S.The document must be accessed by Everyone in order to be embeddable.
Drazick
yes you are right I forgot to mention that thing. Document has to be shared to everyone in order for that to work.
Deepak Yadav
A: 

The Google Docs embedding in iframes via the viewer is problematic in IE8 if not already cached, and is is just not equal to the much better Scribd's facility that allows you to simply make a simple html page with the document embeded via their supplied object code for the document. I then use it as the source file for my iframe. It shows the print (and also a full screen button), right in the embedded frame page. Much more friendly and reliable for the page's visitors.

Deirdre Wall