Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

375
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda