1

Is there any way i can load PDF file (its contents) in a div or iFrame?

I have a bunch of PDF files on a server and, ideally, i need to have a button 'Show file' on a page, clicking on which will load the contents of selected file in a div(iFrame).

rinchik
  • 2,642
  • 8
  • 29
  • 46
  • 1
    Using IFrames with PDFs would be inconsistant in each browser. Using divs might be the best bet for embedding a PDF into a web page and you could use PDFObject: http://pdfobject.com/instructions.php – blamonet Mar 15 '13 at 02:19

2 Answers2

7

You can also use google pdf view by using iframe on your page :

<iframe src="http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>

Instead of this in above code :

http://infolab.stanford.edu/pub/papers/google.pdf

Use your own PDF file path.

You can view the demo here.

http://googlesystem.blogspot.in/2009/09/embeddable-google-document-viewer.html

It's just a suggestion. No downvotes please.

Dead Man
  • 2,880
  • 23
  • 37
0

Google's gview is sometimes unresponsive and given 204 status. Here is the best free alternative. https://stackoverflow.com/a/66548544/2078462

Aimanzaki
  • 566
  • 6
  • 9