Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify parameters to google chrome adobe pdf viewer?

I have an embed tag like this:

<embed src="../../Content/PDF/StockReport.pdf#zoom=50" width="100%" height="100%"> 

the #zoom=50 is a parameter that tells the pdf reader to zoom to 50%. This works in all browsers but google chrome because chrome has a built in pdf viewer.

How can I pass this same parameter to google chrome's pdf viewer ?

like image 586
BentOnCoding Avatar asked Aug 19 '11 18:08

BentOnCoding


People also ask

How do I change the settings to open a PDF in Chrome?

In Chrome, click the three dots in the upper right corner of your browser window. Navigate to Settings › Advanced › Privacy and Security. Click Site Settings › PDF Documents. Use the toggle switch to download PDF files instead of automatically opening them (to turn the viewer off, just click the toggle switch again)

How do you configure your browser to view PDF externally in Adobe Acrobat?

In the Preferences window, click Security, and then click Website Settings next to Internet plug-ins. Select Adobe Reader in the list of plug-ins. Under When Visiting Other Websites, in the drop-down list choose Allow Always and click Done. The browser is now set to use the Adobe Reader plug-in to display PDFs.


2 Answers

After checking various chrome bug reports, I can confirm that Google Chrome ignores the default functionality of Adobe PDF viewer. At the time of this answer there is no way to pass parameters (like zoom) to the Chrome PDF viewer.

EDIT

Progress has been made on this by the Chromium team. The work was being done with reference to both the Acrobat SDK and RFC 3778. As of Dec 2017 Chromium added support for view, zoom, page, toolbar and nameddest and later made it into Chrome.

like image 97
BentOnCoding Avatar answered Oct 13 '22 23:10

BentOnCoding


Use iframe:

  1. It works in Mozilla
  2. It works in Chrome
  3. No Javascript needed

Example:

<div id="mypdf"> <iframe src="/cennik.pdf#zoom=65" style="width: 100%; height: 800px;" frameborder="0" scrolling="no">         <p>Your web browser doesn't support iframes.</p>    </iframe> </div> 
like image 41
damian1baran Avatar answered Oct 14 '22 00:10

damian1baran