从HTML链接到PDF文件时如何设置高度? [英] How to set height on PDF file when linked to from HTML?

查看:599
本文介绍了从HTML链接到PDF文件时如何设置高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚创建了一个链接,点击后会将用户转到PDF文件。

然而,当我在手机上打开PDF文档时,它只显示页面的3/4。页面上的其他内容只是黑色。

在CSS中我可以在PDF上设置默认缩放吗?



HTML代码

 < ; a href =privacyStatement.pdfclass =item icon icon-accessory item-icon-right> 
隐私声明
< i class =icon ion-chevron-right icon-accessory>< / i>
< / a>


解决方案

查看此Adobe文档:




  • 打开PDF文件的参数
    http://www.adobe.com/content /dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf#G4.1500435



它描述了在HTTP请求中设置URL修饰符的不同方法。
但是只有Adobe PDF观看者会尊重他们中的大多数。
如果所请求的PDF是'web优化'(a.k.a. as 'linearized'),则某些功能可能会有效。
其他供应商提供的某些查看者可能仅支持其中一些。

您可以链接到某个特定页面一个PDF在网上托管。
因此,它可以在此页面上打开,而不是在标题页面上打开。 page =< pagenum> 参数就是为此目的而设计的。 以下指向 的链接Page 3 以上PDF打开参数参考。
(上一个链接请求查看者直接在第3页打开目标PDF)



其他参数也很有用:


  • #search =< wordList> strong>。

    示例: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf#search= commentID


  • #nameddest =< destination>

    包含这样一个命名的目的地
    否则它将不起作用。
    您可以使用Acrobat在PDF中创建命名的目的地(不过,使用Adobe Reader not ):
    1.转到所需位置PDF。
    1.点击'查看>导航标签>目的地
    1.转到'选项',选择<扫描文档>
    1.扫描完成后,选择<新建目的地> '选项'菜单中;然后输入您想要的名称。



    重要提示:命名的目的地与书签不同。
    没有记录的链接到书签的URL参数。 ;


    在PDF文档的给定页面上指定注释。
    在此之前使用 #page = .... 命令。
    例如:#page = 1& comment = fd22-457c-84aa-2cf5bed5-452fde0e




缩放



是的,您也可以在特定网页上申请缩放级别:




  • #page = 3& zoom = 100

    这将为第3页请求100%缩放级别。


  • #page = 3& view =适合

    这可能是您想要的!
    要求显示第3页,其内容放大到足以适应整个页面在水平和垂直方向上的窗口。
    如果所需的水平和垂直放大系数不同,它将使用两者中较小的一个,将页面居中放置在另一维度的窗口内。




但是,如果它的工作完全依赖于查看器软件,则无法保证其正常工作。祝你好运!



最初链接的Adobe PDF文件中的更多详细信息....


I've just created a link which when clicked will take the user to a PDF file.

However when I open the PDF document on the mobile it shows only 3/4 of the page. The rest on the page is just black.

Is there a way in the CSS I can set a default zoom on the PDF?

HTML code:

<a href="privacyStatement.pdf" class="item icon icon-accessory item-icon-right">
  Privacy Statement
  <i class="icon ion-chevron-right icon-accessory"></i>
</a>

解决方案

Have a look at this Adobe document:

It describes different ways to set URL modifiers in a HTTP request. But only Adobe PDF viewers will honor most of them. Some may only work if the requested PDF is 'web optimized' (a.k.a. as 'linearized'). Some viewers made by other vendors may support some of these only.

You may be able to link to a specific page within a PDF hosted on the web. So it could open on this page instead of the title page. The page=<pagenum> parameter is meant for that.

For example, try if your viewer jumps from the following link to Page 3 of above PDF Opening Parameter reference. (The previous link requests the viewer to open the destination PDF directly at page 3).

Other parameters are useful too:

  • #search=<wordList>.
    Example: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf#search="commentID"

  • #nameddest=<destination>
    The PDF of course must contain such a named destination. Otherwise it will not work. You can create named destinations within a PDF with Acrobat (not with Adobe Reader, though!): 1. Go to the desired location in the PDF. 1. Click 'View > Navigation Tabs > Destinations'. 1. Go to 'Options', choose 'Scan Document' 1. Once scan is completed, select 'New Destination' from the 'Options' menu; then enter the name you want.

    Important note: Named destinations are not the same as bookmarks. There is no documented URL parameter which would link to a bookmark.

  • #comment=<commentID>
    Specifies a comment on a given page in the PDF document. Use the #page=.... command before this on. For example: #page=1&comment=fd22-457c-84aa-2cf5bed5-452fde0e.

Zoom

Yes, you can also request a zoom level on a specific page:

  • #page=3&zoom=100
    This would request a 100% zoom level for page 3.

  • #page=3&view=Fit
    This is probably what you want! It asks to display page 3, with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, it uses the smaller of the two, centering the page within the window in the other dimension.

However, if it works is fully dependent on the viewer software, there is no guarantee for it to work. Good luck with that!

More details in the initially linked Adobe PDF file....

这篇关于从HTML链接到PDF文件时如何设置高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆