简体   繁体   English

调整从aspx页面链接的pdf的大小

[英]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. 我要从我的页面之一链接到pdf文件。 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; 但是pdf会显示很大(大约233%)...这就是我在acrobat中打开它时的样子-它只是一个保存不良的文件; 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? 我找到了一种使用javascript进行定义的方法,可以在其中定义新窗口的大小,但是随后它在其中打开了一个新窗口……因此,即使它更易于阅读,也不会流动就像刚好在新选项卡中一样...有什么方法可以定义它,以便新选项卡中显示的内容是不同的大小? or is linking to a pdf always limited to just displaying the pdf "as is." 或链接到pdf始终仅限于按原样显示pdf。

Instead of a pdf link I would create a new html page with an iframe. 代替pdf链接,我将使用iframe创建一个新的html页面。

<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 这是我的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. 您可以做的是修改PDF文件并添加一个打开文档的操作,该操作指定打开文档时100%的缩放比例。
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. 如果使用Adobe Reader插件在浏览器中显示文件,则将执行打开操作,并且文档将看起来像您想要的。 Right now I assume the FitWidth zoom option is used by default. 现在,我假设默认情况下使用FitWidth缩放选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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