从网页链接到 PDF 文档中的特定部分(锚点) [英] Linking from a web page to a specific section (anchor) in PDF document
问题描述
理论上有一个 Adobe 的标准指定从在浏览器中单击的链接打开 PDF 文档,以打开 PDF 文档的特定部分(又名锚点"、命名参考").如果您想参考大型 PDF 的特定部分(例如某些标准或规范),此功能应该会很有帮助.
There is a standard from Adobe that in theory specifies opening PDF documents from a link clicked in a browser in a way to open specific sections (AKA "anchor", "named reference") of PDF document. This functionality should be of great help if one would like to refer to a specific portion of large PDF (such as some standard or specification).
然而,从我现在看来,对这个标准的支持几乎不存在.
However, from what I see now, support for this standard is close to non-existent.
例如,这些链接应在第 3.2.6 节注释类型"中打开 Scala 参考 PDF:
For example, these links should open Scala Reference PDF at section 3.2.6, "Annotated Types":
- http://www.scala-lang.org/docu/files/ScalaReference.pdf#subsection.3.2.6
- http://www.scala-lang.org/docu/files/ScalaReference.pdf#nameddest=subsection.3.2.6
- http://www.scala-lang.org/docu/files/ScalaReference.pdf#page=23
(从技术上讲,变体 #3 应该打开第 23 页,这基本上是相同的目的地)
(Techincally, variant #3 should open page #23, which is essentially the same destination)
是否有一种可行的方法(可能是使用一些垫片、专有包装器或其他任何东西)来使其在大多数系统上都能正常工作?Adobe Reader插件的使用份额是多少,我应该关心其他系统吗?
Is there a working way (may be with a couple of shims, proprietary wrappers or whatever else) to make this work on majority of systems? What is the usage share of Adobe Reader plugin, should I care about other systems?
如果不可能,至少我想为每个平台(即 Windows、Linux、Mac)找到一个可行的解决方案,如果他们希望能够使用命名的目标链接,我可以向我的网站用户推荐.
If it's not possible, at least I'd like to find a working solution for every platform (i.e. Windows, Linux, Mac) that I could recommend to my site's users if they want to be able to use named destination links.
根据我的测试:
- Windows、MSIE/Firefox/Chrome、Adobe Acrobat Reader 插件 - 所有变体都适用于 9+ 版本,但是:
- MSIE 有一个奇怪的缓存问题(即锚点在文档被缓存之前不起作用)
- 旧版本不起作用
- 它有链接格式问题:通常,它应该以http://"开头,是到真实网络服务器的常规绝对链接.相对链接、samba 风格的链接 (
\HOSTdirfile.pdf#something
),除了http"(或者可能是https")方案之外的任何其他东西都不起作用
- Windows, MSIE/Firefox/Chrome, Adobe Acrobat Reader plugin - all variants work with version 9+, but:
- MSIE has a weird caching issue (i.e. anchor does not work until document was cached)
- Older versions do not work
- It has issues with link format: generally, it should be regular absolute link to a real web server, starting with "http://". Relative links, samba-style links (
\HOSTdirfile.pdf#something
), anything else besides "http" (or probably, "https") scheme won't work
如果您尝试以各种不同的组合进行测试,我将不胜感激.
I'd appreciate if you'd try it to test in various different combinations.
推荐答案
通常看起来可行的是变体 #4,但在这种情况下使用的是 PDF 文档中实际划分页面时的页数
What seems to work in general is variant #4 but using the number of the page as in actual division into pages in the PDF document, in this case
http://www.scala-lang.org/docu/files/ScalaReference.pdf#page=31
PDF 文档的页码从内容本身开始,在目录之后,但该编号与 #page=... 中使用的编号不同.
The PDF document has page numbers that start from the content proper, after the table of content, but that numbering differs from the one to be used in #page=...
这篇关于从网页链接到 PDF 文档中的特定部分(锚点)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!