Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

365
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda