Back
What is the recommended way to embed PDF in HTML?
What does Adobe say itself about it?
In my case, the PDF is generated on the fly, so it can't be uploaded to a third-party solution prior to flushing it.
Try using the code given below:
<embed src="http://example.com/the.pdf" width="500" height="375" type="application/pdf">
<embed src="http://example.com/the.pdf" width="500" height="375"
type="application/pdf">
The method is easy, quick and to the point and it doesn't require any third-party script:
UPDATE (1/2018):
The Chrome browser on Android no longer supports PDF embeds. You can just get around this by using the Google Drive PDF viewer like this:
<embed src="https://drive.google.com/viewerng/viewer?embedded=true&url=http://example.com/the.pdf" width="500" height="375">
<embed src="https://drive.google.com/viewerng/
viewer?embedded=true&url=http://example.com/the.pdf" width="500" height="375">
Or
You can just use the PDF.JS library. It's a pure HTML5/JavaScript renderer for PDF documents without any third-party plugins.
For an online demo, refer to this link: http://mozilla.github.com/pdf.js/web/viewer.html
GitHub: https://github.com/mozilla/pdf.js
31k questions
32.8k answers
501 comments
693 users