È possibile collegarsi a un segnalibro all'interno di un PDF utilizzando i parametri URL?

StackOverflow https://stackoverflow.com/questions/125632

  •  02-07-2019
  •  | 
  •  

Domanda

Quando si fornisce un collegamento a un file PDF su un sito Web, è possibile includere informazioni nell'URL (parametri di richiesta) che faranno passare il plug-in del browser PDF (se utilizzato) a un particolare segnalibro anziché aprirlo semplicemente a cominciare?

Qualcosa del tipo: http://www.somehost.com/user-guide .pdf? bookmark = capitolo3 ?

Se non fosse un segnalibro, sarebbe possibile andare a una determinata pagina?

Suppongo che se c'è una risposta potrebbe essere specifica per il plug-in del lettore PDF di Adobe o qualcosa del genere, e potrebbe avere limitazioni di versione, ma mi interessa soprattutto sapere se la tecnica esiste affatto.

È stato utile?

Soluzione

Sì, puoi collegarti a pagine specifiche in base al numero o alle località con nome e funzionerà sempre se il browser dell'utente utilizza Adobe Reader come plug-in per la visualizzazione di file PDF .

Per una pagina specifica per numero:

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

Per una posizione denominata (destinazione):

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

Per creare destinazioni all'interno di un PDF con Acrobat:

  1. Naviga manualmente attraverso il PDF per la posizione desiderata
  2. Vai a Visualizza > Schede di navigazione > Destinazioni
  3. In Opzioni, seleziona Scansione documento
  4. Una volta completato, seleziona Nuova destinazione dal menu Opzioni e inserisci un nome appropriato

Altri suggerimenti

RFC 3778 la sezione 3 specifica " Identificatori di frammenti " che può essere utilizzato con file PDF, che includono nameddest e page.

Esistono più parametri di query che possono essere gestiti. Elenco completo di seguito:

Fonte

+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+
| 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.                                   |                                                      |
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+

Vale la pena aggiungere che La soluzione di Wayne funziona anche in in:

  • Chrome (dal v. 14 del 2011, vedi questo problema per dettagli) (testato su v. 44),
  • Firefox (testato su v. 40),
  • Opera (testato su v. 31),

... MA non funziona in:

  • Safari (v. 8) (ma è presente una richiesta di funzionalità nel tracker bug di Apple Safari)

PDF Open Parameters documenta i frammenti di URL disponibili che puoi utilizzare.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top