Google Docs Embed Script

Ever wanted to view a PDF in the body of a web page? Google offers an undocumented feature that will let you view PDFs in an embedded iframe.

Here’s an example: A bike map for the Tulsa MS-150! It’s hosted here on my domain.

Upload a PDF to your web site and put this code in the page (replace the http://yourdomain.uld part with the path to your pdf).

You can change the size and alignment by modifying the style statements or adding a css class.

<iframe src="" style="width:500px; height:600px;" frameborder="0"></iframe>

If you’re using WordPress, put the code in the page in text mode, then switch back to visual editor.

Google will render it for you using their document viewer. Works the same way with Microsoft Docs (Word, Power Point, etc.).

View Comments

Leave a Reply