Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
Is it possible to set default zoom or control Microsoft Edge built-in PDF Viewer from JavaScript?

I'm working on an application which displays PDF in iframe. I'd like to open it as "Fit to width". In JavaScript I add #view=FitH:

<iframe id="previewFrame" frameborder="0" src="' + link + '#view=FitH"></iframe>

This works in Chrome and Firefox, but not in Edge.

Is there a way how to set the default zoom in Edge's PDF Viewer?

Or control the Viewer from JavaScript, something like pdfZoomInButton.click()?

Update:

The actual link to the file looks like this

https://myApp/Services.asmx/DownloadFile?id=someId#view=FitH

On the server side there's quite complicated process but in the end the file is loaded into a stream and then sent as response like this stream.CopyTo(response.OutputStream);

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No problem, those directives are in url terms "fragments" thus must not be fragmented from their parent. The convention was introduced by Adobe for use with PDF plugins, so the whole string needs to be handled as one by the pdf viewer. All browsers use differently, Edge is better at respecting Adobe phrasing whereas Firefox use their own response to different phrasing. In all cases they are a sub set of Adobe's full repertoire. Plug-ins other than Acrobat may just respond to some or none, depending on how they are transferred.

enter image description here

The inline Frame in Edge

<table><tr><td>in.pdf#view=Fit</td><td>in.pdf#view=FitH (=default)</td><td>in.pdf#view=FitV</td></tr><tr>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=Fit"><p>Your browser does not support iframes.</p></iframe></td>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=FitH"><p>Your browser does not support iframes.</p></iframe></td>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=FitV"><p>Your browser does not support iframes.</p></iframe></td>
</tr></table>
<p>
<table><tr><td>in.pdf#view=FitB (ignored ?)</td><td>in.pdf#view=FitH,200 (works)</td><td>in.pdf#view=FitV,200 (N/A for portrait)</td></tr><tr>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=FitB"><p>Your browser does not support iframes.</p></iframe></td>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=FitH,200"><p>Your browser does not support iframes.</p></iframe></td>
<td><iframe id="previewFrame" frameborder="0" src="in.pdf#view=FitV,200"><p>Your browser does not support iframes.</p></iframe></td>
</tr></table>

I see the opposite latest Firefox versions do not work with #AcrobatViewTags 1st example is native 2nd example is where tags do not get handed over.

enter image description here enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!