How to use PDF open parameter (e.g. fitH) in Chrome/ FireFox browser?

前端 未结 1 523
小蘑菇
小蘑菇 2021-01-26 16:55

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

There are a set of open parameter specify how the viewer should open the pdf . Howe

相关标签:
1条回答
  • 2021-01-26 17:27

    Searching a solution for a problem very similar to yours, I found an interesting thread on forum.asp.net. http://forums.asp.net/t/1877403.aspx?Issue+with+embedded+pdf+object+in+chrome+browsers

    At the end of the page, there is a workaround by a user working smoothly in Chrome. That seems to solve the problem.

    Here it is an example:

    <iframe src="/Downloads/MyPdfDocument.pdf#view=fitH" width="700"  height="880"></iframe>
    

    For users fighting with http://pdfobject.com/ -> "pdfobject.js" like me, you can change few lines of code on both minified and develop version of pdfobject.

    Find:

    c.innerHTML='<object    data="'+a+'" type="application/pdf" width="'+i+'" height="'+z+'"></object>';return c.getElementsByTagName("object")[0];
    

    and change with this line of code:

    c.innerHTML='<iframe src="'+a+'" width="'+i+'" height="'+z+'"></iframe>';return c.getElementsByTagName("iframe")[0];
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题