Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k points)

What is the recommended way to embed PDF in HTML?

  • iFrame?
  • Object?
  • Embed?

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.

1 Answer

0 votes
by (40.7k points)

Try using the code given below:

<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">

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

Related questions

0 votes
1 answer
asked Aug 14, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jan 2, 2021 in Python by ashely (50.2k points)

Browse Categories

...