代码之家  ›  专栏  ›  技术社区  ›  Ash

是否可以使用URL参数链接到PDF中的书签?

  •  77
  • Ash  · 技术社区  · 16 年前

    当在网站上提供指向PDF文件的链接时,是否可以在URL(请求参数)中包含信息,该URL(请求参数)将使PDF浏览器插件(如果使用)跳转到特定书签,而不只是在开始时打开?

    类似: http://www.somehost.com/user-guide.pdf?bookmark=chapter3 ?

    如果不是书签,是否可以转到特定页面?

    我假设如果有答案的话,它可能是特定于Adobe的PDF阅读器插件或其他东西的,并且可能有版本限制,但是我主要对该技术是否存在感兴趣。

    5 回复  |  直到 8 年前
        1
  •  75
  •   Greg Dubicki    9 年前

    是的,您可以按编号或指定位置链接到特定页面,这将始终有效 如果用户的浏览器使用Adobe Reader作为查看PDF文件的插件 .

    对于特定页码:

    <a href="http://www.domain.com/file.pdf#page=3">Link text</a>
    

    对于指定位置(目标):

    <a href="http://www.domain.com/file.pdf#nameddest=TOC">Link text</a>
    


    使用Acrobat在PDF中创建目的地:

    1. 在PDF中手动浏览所需位置
    2. 转到“查看”>“导航选项卡”>“目的地”
    3. 在“选项”下,选择“扫描文档”
    4. 完成后,从“选项”菜单中选择“新建目标”,并输入适当的名称。
        2
  •  16
  •   sanxiyn    16 年前

    RFC 3778 第3节指定了可与PDF文件一起使用的“片段标识符”,其中包括NamedDest和Page。

        3
  •  9
  •   Matas Vaitkevicius user3782709    8 年前

    可以处理多个查询参数。 完整列表如下:

    Source

    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | Syntax                  | Description                                                                                  | Example                                              |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | nameddest=destination   | Specifies a named destination in the PDF document                                            | http://example.org/doc.pdf#Chapter6                  |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | page=pagenum            | Specifies a numbered page in the document, using an integer                                  | http://example.org/doc.pdf#page=3                    |
    |                         | value. The document’s first page has a pagenum value of 1.                                   |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | comment=commentID       | Specifies a comment on a given page in the PDF document. Use                                 | #page=1&comment=452fde0e-fd22-457c-84aa-             |
    |                         | the page command before this command.                                                        | 2cf5bed5a349                                         |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | collab=setting          | Sets the comment repository to be used to supply and store                                   | #collab=DAVFDF@http://review_server/Collab           |
    |                         | comments for the document. This overrides the default comment                                | /user1                                               |
    |                         | server for the review or the default preference. The setting is of the                       |                                                      |
    |                         | form store_type@location, where valid values for store_type are:                             |                                                      |
    |                         | ● DAVFDF (WebDAV)                                                                            |                                                      |
    |                         | ● FSFDF (Network folder)                                                                     |                                                      |
    |                         | ● DB (ADBC)                                                                                  |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | zoom=scale              | Sets the zoom and scroll factors, using float or integer values. For                         | http://example.org/doc.pdf#page=3&zoom=200,250,100   |
    | zoom=scale,left,top     | example, a scale value of 100 indicates a zoom value of 100%.                                |                                                      |
    |                         | Scroll values left and top are in a coordinate system where 0,0                              |                                                      |
    |                         | represents the top left corner of the visible page, regardless of                            |                                                      |
    |                         | document rotation                                                                            |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | view=Fit                | Set the view of the displayed page, using the keyword values                                 | http://example.org/doc.pdf#page=72&view=fitH,100     |
    | view=FitH               | defined in the PDF language specification. For more information,                             |                                                      |
    | view=FitH,top           | see the PDF Reference.                                                                       |                                                      |
    | view=FitV               | Scroll values left and top are floats or integers in a coordinate                            |                                                      |
    | view=FitV,left          | system where 0,0 represents the top left corner of the visible                               |                                                      |
    | view=FitB               | page, regardless of document rotation.                                                       |                                                      |
    | view=FitBH              | Use the page command before this command.                                                    |                                                      |
    | view=FitBH,top          |                                                                                              |                                                      |
    | view=FitBV              |                                                                                              |                                                      |
    | view=FitBV,left         |                                                                                              |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | viewrect=left,top,wd,ht | Sets the view rectangle using float or integer values in a                                   |                                                      |
    |                         | coordinate system where 0,0 represents the top left corner of the                            |                                                      |
    |                         | visible page, regardless of document rotation.                                               |                                                      |
    |                         | Use the page command before this command.                                                    |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | pagemode=bookmarks      | Displays bookmarks or thumbnails.                                                            | http://example.org/doc.pdf#pagemode=bookmarks&page=2 |
    | pagemode=thumbs         |                                                                                              |                                                      |
    | pagemode=none           |                                                                                              |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | scrollbar=1|0           | Turns scrollbars on or off                                                                   |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | search=wordList         | Opens the Search panel and performs a search for any of thewords in the specified word list. | #search="word1 word2"                                |
    |                         | The first matching word ishighlighted in the document.                                       |                                                      |
    |                         | The words must be enclosed in quotation marks and separated byspaces.                        |                                                      |
    |                         | You can search only for single words. You cannot search for a string of words.               |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | toolbar=1|0             | Turns the toolbar on or off.                                                                 |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | statusbar=1|0           | Turns the status bar on or off.                                                              |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | messages=1|0            | Turns the document message bar on or off.                                                    |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | navpanes=1|0            | Turns the navigation panes and tabs on or off.                                               |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | highlight=lt,rt,top,btm | Highlights a specified rectangle on the displayed page. Use the                              |                                                      |
    |                         | page command before this command.                                                            |                                                      |
    |                         | The rectangle values are integers in a coordinate system where                               |                                                      |
    |                         | 0,0 represents the top left corner of the visible page, regardless of                        |                                                      |
    |                         | document rotation                                                                            |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    | fdf=URL                 | Specifies an FDF file to populate form fields in the PDF file beingopened.                   | #fdf=http://example.org/doc.fdf                      |
    |                         | Note: The fdf parameter should be specified last in a URL.                                   |                                                      |
    +-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
    
        4
  •  7
  •   Community CDub    8 年前

    值得一提的是 Wayne's solution 作品 在:

    • 铬(自2011年第14版起,见 this issue 详细信息(在第44节测试)
    • 火狐(40版测试)
    • Opera(第31节测试)

    但…… 不工作 在:

    • Safari(第8版)(但在苹果的Safari Bug跟踪器中有一个功能请求)
        5
  •  6
  •   rslemos    10 年前

    PDF Open Parameters 记录可用的URL片段。