In-page embedded viewable PDF documents without a PDF reader

Here is a neat trick which I've found: using a tool by Google named Docs Viewer you can embed PDF (Or office and Postscript) files into a webpage to be viewed on screen, even without a PDF reader plugin installed in the user's browser.

Simply use the snippet below and change where your_document_here is mentioned twice with a full URL, e.g. https://example.com/doc.pdf.

<object data="your_document_here" type="application/pdf" style="width:100%; height:700px">
<iframe src="https://docs.google.com/viewer?url=your_document_here&embedded=true"></iframe>
</object>

Here is an article on Google's System blog for more info: https://googlesystem.blogspot.co.uk/2015/02/google-docs-viewer-page-no-longer.html.


Discuss on X (Twitter)