show pdf files in a php page

放肆的年华 提交于 2019-11-28 11:16:51

问题


I have some pdf files and want to show them online in my website,not downloading or displaying with acrobat or firefox add-on, actullay I need a pdf viewer. I am not sure if there ia any prepared library or plugin. I guess I have to convert each page of pdf to an image file,but how can I do it?

thank you.


回答1:


Like @Lix said most modern browsers have this built in it works well in chrome and firefox. This is what I do...

<object height="950" data="sample-report.pdf" type="application/pdf" width="860">

            <p>It appears you don't have a PDF plugin for this browser.
                No biggie... you can <a href="sample-report.pdf">click here to
                download the PDF file.</a>
            </p>

        </object>

It degrades well if the browser doesn't support viewing PDF by letting one download it. I have looked for other solutions such as converting to html or image. But I don't like to load lots of large images and converting to html loses much of the formatting.

You can convert on your server though if your running linux with this command...

convert abc.pdf abc.jpg

-EDIT-- Firefox uses PDF.js to render PDFs. I've looked into before, but the complexity wasn't worth it for any of my projects.

Hope this helps. Aloha.




回答2:


I think you are looking for this http://flexpaper.devaldi.com/

and the similar question

Flash Pdf viewer just like scribd




回答3:


It is possible to view your files in google docs viewer in an iframe:

<iframe src="http://docs.google.com/gview?url=http://www.example.com/yourPDFfile.pdf" frameborder="0"></iframe>


来源:https://stackoverflow.com/questions/12551287/show-pdf-files-in-a-php-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!