2008-09-24 17 views
74

Al proporcionar un enlace a un archivo PDF en un sitio web, ¿es posible incluir información en la URL (parámetros de solicitud) que hará que el complemento del navegador PDF (si se utiliza) salte a un marcador en particular en lugar de abrir al principio ?¿Es posible vincular a un marcador dentro de un PDF usando parámetros de URL?

Algo así como: http://www.somehost.com/user-guide.pdf?bookmark=chapter3?

Si no es un marcador, ¿sería posible ir a una página en particular?

Supongo que si hay una respuesta puede ser específica del complemento de lector de PDF de Adobe o algo así, y puede tener limitaciones de versión, pero estoy interesado sobre todo si la técnica existe.

Respuesta

73

Sí, puede vincular páginas específicas por número o ubicaciones con nombre y eso siempre funcionará si el navegador del usuario utiliza Adobe Reader como complemento para ver archivos PDF.

Para una página específica por número:

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

Para una ubicación con nombre (destino):

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


Para crear destinos dentro de un PDF con Acrobat:

  1. navegar manualmente a través del PDF para la ubicación deseada
  2. Ir a Ver> Fichas de navegación> Destinos
  3. En Opciones, seleccione Escanear documento
  4. Una vez que esto se ha completado, seleccione Nuevo destino en el menú de opciones y escriba un nombre apropiado
+13

nota importent: destinos con nombre no son los favoritos. Puede agregar destinos con nombre usando Adobe Acrobat (¡completo, no lector!) Y su panel de navegación "destinos". No tengo conocimiento de cómo un enlace a marcadores directamente. No hay un parámetro de url documentado. – eFloh

+0

Sé que esta es una vieja pregunta. Pero me pregunto si alguien sabe cómo agregar destinos con nombre a un pdf al construir el pdf en el código .net. Estamos utilizando el componente dinámico pdf para crear nuestros pdf: s en .net. El pdf dinámico no admite la adición de designaciones con nombre. – mortb

+1

no funciona con referencias relativas, p. 'somedir/my.pdf # page = 3', y * PDF-XChange Viewer * (creado a partir de * my.docx * vía * Guardar como ... pdf * de * MS Office Professional Plus 2010/14.0.7116.5000 *) –

14

RFC 3778 sección 3 especifica "Identificadores de fragmentos" que se pueden usar con archivos PDF, que incluyen nameddest y page.

7

Vale la pena añadir que Wayne's solution también obras en:

  • Chrome (. Como V 14 a partir de 2011, véase this issue para más detalles) (. Probado en v 44),
  • Firefox (probado en v. 40),
  • Opera (probado en v. 31),

... pero es no funciona en:

  • Safari (v. 8) (pero hay una función solicitada en el rastreador de errores de Safari de Apple)
+0

¿Tiene alguna información sobre cómo IE maneja los enlaces profundos de PDF? – TeeJaay

+0

No, no tengo IE en mi máquina para probarlo, lo siento @TeeJaay. –

5

Hay varios parámetros de consulta que pueden manejarse. lista completa a continuación:

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         | #[email protected]://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 [email protected], 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.         |              | 
+-------------------------+----------------------------------------------------------------------------------------------+------------------------------------------------------+ 
+0

Es bueno que hayas encontrado documentos completos para esto, @Matas. ¿Pero no hay ningún documento más nuevo disponible? Este tiene aproximadamente 10 años ... –

+0

@GregDubicki Hola Greg, no creo que pueda haber uno nuevo, podría haber uno si publicaran un nuevo tipo de pdf (como pdfx) ... depende de dónde mecanismo que maneja url es, supongo ... –

Cuestiones relacionadas