Question

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

Regards

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top