简体   繁体   中英

Resizing a pdf linked from aspx page

So this is a pretty straightforward question...

I'm linking to a pdf file from one of my pages. The link works fine...

    <a href="/information/11-2013-Offer-lobby.pdf" target="_blank">link text</a>

but the pdf is displaying very large (about 233%)... it's exactly how it looks when I open it in acrobat-it's just a poorly saved file; my question is whether there is a way to define how it is sized in the new tab?

I found a way to do it with javascript where I could define the size of the new window, but then it opens it in, yup, a new window... so even though it's a little easier to read, it doesn't flow as nicely as if it were just in a new tab... Is there any way to define it so that what's displayed in the new tab is a different size? or is linking to a pdf always limited to just displaying the pdf "as is."

Instead of a pdf link I would create a new html page with an iframe.

<html>
<body>
<!--Adjust the width-->
<iframe id="pdfIframe" style="width: 70%; display: none;"></iframe>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</body>
</html>

// using jQuery
$(document).ready(function(){
    var pdfIframe = $("#pdfIframe");
    pdfIframe.attr("src", "http://www.irs.gov/pub/irs-pdf/fw4.pdf");
    pdfIframe.height($(document).height()-50); // adjust this to maximize height
    pdfIframe.show();
});

Here is the link to my JsFiddle

What you can do is to modify the PDF file and add a document open action that specifies a 100% zoom when the document is opened.
If the Adobe Reader plugin is used to display the file in the browser then the open action will be honored and the document will look like you want. Right now I assume the FitWidth zoom option is used by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM