Linking to a PDF from an HTML web page is simple.
Linking to a specific place within a PDF takes a little more work. Note:
- The following only works when the HTML document is served by a web server. It will not work from a local drive.
- You cannot link to bookmarks within a PDF. You can link to named destinations, however. Other programs use these terms differently - see Link to bookmarks in a PDF if you're unclear on what "bookmark" and "named destination" mean in Acrobat.
The following is taken from the Acrobat 4 help file (AcroHelp.PDF) starting at roughly page 488. It may or may not be included in later Acrobat help files.
Find an Acrobat 8 update here
Linking to PDF documents from HTML
You can link to a PDF document from an HTML document with the HTML <HREF> tag. When a Web user clicks the link on the HTML page, the PDF document opens. The document can fill an entire browser window or launch an Acrobat viewer as a helper application (it depends on how users have configured their Web browsers).
The following example uses <HREF> to link to a PDF document:
<a href="http://www.adobe.com/prodlist.pdf">
You can also specify actions to be performed on the PDF document once it is opened. For example, you might want to open the document to a particular page or destination or set it to open with bookmarks displayed. To include one of these action commands with your <HREF> link, type a number sign (#) and then the command immediately after the PDF filename.
The following table shows the possible action commands. Replace variables (in italics) with the specific instructions for your PDF document. The variables in square brackets ([ ]) are optional.
Description | Command | Comments |
Go to a page | page=page_number | The page number must be an integer.
A PDF file’s first page has a page number of 1. |
Go to a destination | #destination_string | |
Zoom or scroll a page | zoom=scale[, left, top] | All values must be integers or in floating-point notation. A scale of 100 gives 100% zoom. Scroll values for left and top are user coordinates (0,0 is the top left of a visible page, regardless of page rotation). |
Set the view of a page | view=Fit
view=FitH[, top]
view=FitV[, left]
view=FitB
view=FitBH[, top]
view=FitBV[, left] |
Fit, FitH, and so on are keywords defined in the Portable Document Format Reference Manual (www.adobe.com). Scroll values for left and top must be integers or in floating-point notation. These values are user coordinates (0,0 is the top left of a visible page, regardless of page rotation). |
Set the location and size of the view rectangle | viewrect=left, top, width,height |
All values must be integers or in floating-point notation. Scroll values for left and top are user coordinates (0,0 is the top left of a visible page, regardless of page rotation). |
Display bookmarks or thumbnails | pagemode=mode |
The possible values are bookmarks, thumbs, and none |
Display the scrollbars | scrollbar=boolean_value | The possible values are true and
false. |
Display the tool bar | toolbar=boolean_value | The possible values are true and false. |
Note: The action commands are not case-sensitive (except for the value of a destination). There can be no spaces in the URL command line, and each command cannot be more than 32 characters in length. If you supply a floating-point value, only one digit following a decimal is used.
These are examples of valid action commands for PDF documents linked from HTML:
<a href="http://www.adobe.com/prodlist.pdf#page=3">
<a href="http://www.adobe.com/prodlist.pdf#Digital-Imaging">
<a href="http://www.adobe.com/prodlist.pdf#zoom=200,250,100">
[Note: Most of these examples are from the Acrobat 4 help files, with corrections called for by "How to Link from an HTML Page to a Specifc Page in PDF File" formerly available on Adobe's Support Knowledgebase. ]
You can put multiple action commands in a single URL command line if you separate the commands with an ampersand (&). Each command can be up to 32 characters in length. Be careful not to introduce any spaces in the line. For example,
<a href="http://www.adobe.com/prodlist.pdf#page=72&view=FitH,100">
<a href="http://www.adobe.com/prodlist.pdf#pagemode=bookmarks&page=3">
The actions are executed from left to right as they appear in the command line.
It is possible that later actions will override the effects of previous actions, so be sure to order the actions appropriately. For example, page actions should appear before zoom actions.
Last updated 1/24/2007 4:49:34 PM
|