HTML PDF Viewer

后端 未结 3 1202
我寻月下人不归
我寻月下人不归 2021-02-06 18:36

Is there any alternative way to view PDF files on the web instead of using Acrobat Reader? I need to control the viewer to programmatically trigger the printing of the document.

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-06 19:06

    The easiest I would think is to use the Google Doc Viewer:

    
    

    You need to host your PDF files somewhere online, may be in a file in your public website ( it needs to be a public site) and put the link to the PDF file in "PathToMyPdfFile.pdf" in the iFrame above. Then set the width and height you need.

    Google even generates this code for you here:

    https://docs.google.com/viewer
    

    Then simply put this iframe anywhere in the body of your page where you want to display your PDF. This also supports many other file formats too.

提交回复
热议问题