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);
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.
<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.