0 votes
1 view
in Web Technology by (22.4k 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.3k 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.8k points)
0 votes
1 answer
asked Jul 12, 2019 in Python by Sammy (47.8k points)
+1 vote
1 answer
asked Oct 31, 2019 in Data Science by chandra (28.1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...