How to embed a PDF viewer in a page?

You could consider using PDFObject by Philip Hutchison.

Alternatively, if you're looking for a non-Javascript solution, you could use markup like this:

1,187 10 10 silver badges 10 10 bronze badges answered Dec 29, 2012 at 11:23 Ian Gregory Ian Gregory 5,800 1 1 gold badge 30 30 silver badges 42 42 bronze badges

Maybe stuff changed since 2012, but if I use this approach, the PDF gets downloaded automatically by Chrome and opened in an external browser.

Commented Jan 12, 2020 at 8:07

PDF.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance. It is community-driven and supported by Mozilla Labs.

You can see the demo here.

answered Dec 29, 2012 at 11:37 3,295 1 1 gold badge 28 28 silver badges 34 34 bronze badges where is the tutorial? Commented Oct 15, 2021 at 7:52 @RohanDevaki, which tutorial? Here is a walkthrough: mozilla.github.io/pdf.js/examples Commented Oct 16, 2021 at 15:52

This might work a little better this way

188 1 1 silver badge 12 12 bronze badges answered Mar 26, 2016 at 11:10 DoesEatOats DoesEatOats 653 7 7 silver badges 13 13 bronze badges This worked for me. But I also had to add attribute type="application/pdf" . Commented Jul 21, 2020 at 7:00 This worked for me with type="application/pdf" Commented Aug 5, 2021 at 17:17 show the output Commented Oct 15, 2021 at 7:52 just using embed tag like this fixed my issue. Commented yesterday

If I'm not mistaken, the OP was asking (although later accepted a .js solution) whether Google's embedded PDF display server will display a PDF on his own website.

So, one and a half years later: yes, it will.

Edit: Re-reading, OP was asking for solutions that don't use iFrames. I don't think that's possible with Google's viewer.

answered Sep 2, 2014 at 0:23 310 2 2 silver badges 10 10 bronze badges

have a try with Flex Paper http://flexpaper.devaldi.com/

it works like scribd

answered Dec 29, 2012 at 11:19 19.2k 17 17 gold badges 77 77 silver badges 109 109 bronze badges

Be sure to test any solution across different Reader preferences. A site visitor may have their browser set to open the PDF in Reader/Acrobat as opposed to the browser, e.g., by disabling the Acrobat plugin in Firefox..

I can't be sure of my results, because I have two different Acrobat plugins that Firefox recognizes due to my having different versions of Adobe Acrobat and Adobe Reader, but it does appear that you at least need to test what happens if a website visitor has their browser set to not open the PDF in the browser. It could be quite annoying when they look at what appears to be an otherwise usable web page and their browser is nagging them to open a PDF file that they think they didn't request. In some cases, the PDF file spontaneously opened in Adobe Reader, not the browser, and in other cases the browser threw up a dialog saying the file didn't exist.

I ran into such mismatches with iframe and object both, different issues for different code.

This is for simple HTML code. I haven't tried the suggested frameworks.