4

I need to open pdf file into browser without Adobe Reader. Is there any API with php which open PDF files into browser.

Regards

Dharm Shankar
  • 53
  • 2
  • 6
  • As long as I know, there is no way to display a PDF in the browser, without PDF-Viewing Engine like Adobe Reader, except when you reneder the pdf to html (like google-docs does). But I don't know any library which does this. Maybe there is one (maybe googles is open-source) - I am interested too! – helle Feb 16 '12 at 09:24

4 Answers4

2

No.

PHP runs on the server. The only "browser API" it has access to is HTTP.

If you want to render a PDF on the client, then the client needs a PDF renderer. There are JavaScript PDF readers, but I can't comment on their cross-browser support or maturity.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

If you pdf files are put online and not restricted, you can try using Google Doc Viewer. It's a very nice way to put the Viewer in <iframe /> so that it can be combined with your web page.

https://docs.google.com/viewer

Victor Wong
  • 2,486
  • 23
  • 32
1

You can use SWFTools to convert PDFs to Flash. But SWFTools default skins are not looking good at all, so you can check Flexpaper as a viewer. In case you are going to make your own skin, then could be useful to read: SWFTools (pdf2swf) to properly work with Flex

Another solution is pdf.js (as Quentin point out), but AFAIR this script was not usable(back then, when I looked for) for PDFs with complex structures (complex gradients for example).

If you need to publish documents as "private" you should look at services as Issuu or you will have to protect files from downloading.

Boris Belenski
  • 1,387
  • 13
  • 20
0

It is not feasible to view the PDF files without a viewer like Adobe Reader. If you just don't want to use Adobe Reader, you may try a PDF viewer plug in for web browser from some other company.

However, if you do not want to use a viewer at all and want to write/build your own viewer then a better option is to convert the PDF to scalable images and then show them on the web page using image tags. You can also create such a viewer using JavaScript.

Even you can find many already available JavaScript based viewers which can show those images.

Shahzad Latif
  • 1,408
  • 12
  • 29