PDF view in browser

1

I'm researching a way to view PDF file in the browser and print it all over the web (This action will be done by the user). Someone knows some tool that works with this. I'm using PHP and MySQL in my project. My intention is that you look similar to Microsoft's Skydrive PDF viewer. But not with all the features. Display and print only!

    
asked by anonymous 07.03.2014 / 13:06

2 answers

4

Usually browsers are able to render PDF, so the simplest way is to route the user directly to the pdf with a simple link or even using a <iframe> . If the browser can not render, the file will be downloaded.

An alternative is to use PDF.js :

  

pdf.js is an HTML5-based technology experiment that aims to build a faithful and efficient Portable Document Format (PDF) renderer without the help of native code.

You can see an example of it working here: demo . Note the button to print in the upper right corner.

On GitHub: Source Code .

    
07.03.2014 / 13:14
1

You can use the Google Docs viewer , which allows you to reference documents online (eg PDF, DOC, between others), and then use one of the options given by the viewer:

  • URL: preview page url

  • Link <a href='...'> allows you to link to a preview page

  • Iframe <iframe src='...'></iframe> lets you add embedded pdf to any page

It works on all browsers I've tested ... even in IE7 it works.

To place the document inside your site, you can use the iframe option, and add the same on any page.

Example of iframe generated by the viewer:

<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Fdownload.inep.gov.br%2Feducacao_superior%2Fenade%2Fmanuais%2Fmanual_enade_2013.pdf&embedded=true"width="600" height="780" style="border: none;"></iframe>

Obviously, you can generate this tag in your code if you need to.

    
07.03.2014 / 16:46