How to set match width when embedding PDF in Chrome?

When I insert a PDF file for viewing in Chrome / Firefox, regardless of whether I set its width / sets the parameter, it does not change the width of the PDF content, the only thing I can control is the viewing size in pdf format, but not pdf size pages, is there any way to control this? thanks

<object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200"></object> <object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf#view=fit" width="1500" height="1200"></object> <object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200"> <parm name="view" value="fit/> </object> 

None of the codes above work

+6
source share
2 answers

I had the same problem and after quite a lot of digging I discovered that the problem was with the PDF viewer in HTML format. It does not accept public url parameters like adobe, see https://code.google.com/p/chromium/issues/detail?id=64309 .

To test this, I typed "about: plugins" in Chrome, turned off the Chrome pdf viewer, and turned on the adobe viewer. As soon as I did this, the following code worked for me:

 <object type="application/pdf" data="2010%20AHS%20XC%20Results.pdf" width="1500" height="1200"> <parm name="view" value="FitH/></object> 

I understand that this is not a real solution, since you can’t control whether visitors to your site have this plugin or not, but you want to leave this answer here so that others who see this message know that the problem is related to Chrome Pdf viewer It does not accept URL opening parameters from 11/21/14 and therefore does not waste time searching for problems in its code.

+5
source

I know this is an old question, but I ran into the same problem. I have the same problem with chrome v43 (but not in 40/41).

Solution: Use the <embed> tag instead to display the PDF. Use an <iframe> with the src attribute with the PDF rendering url. If you do not want to reveal your path to the PDF file, specify a script path that will print the contents of the PDF with the title application/pdf .

+2
source

Source: https://habr.com/ru/post/952630/


All Articles