Acrobat User Community

Creating buttons for PDF navigation with Acrobat 8 and 9

By Ted PadovaApril 16, 2007

Previous tips related to PDF interactivity dealt with bookmarks and popup menus for page and document navigation. To continue with page navigation, let's explore how and why to use buttons in a PDF document using Acrobat 8 or 9.

Since the Page Navigation toolbar contains tools for navigating forward and backward in a document, and the tools appear by default, most of the time you don't need additional navigation items, such as buttons or links. However, if you decide to hide the Acrobat toolbar or to configure a PDF document to open in full-screen mode, buttons can be helpful for users unfamiliar with keyboard shortcut-based navigation. Also, it's a must-have feature for certain files you distribute to Adobe Reader users who have little knowledge of using program tools and shortcuts.

In this first part, I'll talk about creating navigation buttons. In Part 2, I'll discuss both opening files with the toolbars hidden and opening documents in full-screen mode.

Creating navigation buttons

Navigation buttons have a couple of advantages over using links. First, buttons can be assigned icon appearances. If your document background design doesn't have an icon—such as an arrow or some other image—where a user intuitively understands that a mouse click moves forward/back, you can add a button face to Button fields. Second, Button fields can be duplicated across a range of pages. If you use Acrobat Standard, you're stuck with links where no icons or text can be added to the link appearance, and the links need to be created (or pasted) on each individual page. That may be quite tedious if your PDF document contains many pages.

To create buttons for page navigation, follow these steps:

1. Create a Button field. Open the Forms toolbar and select the Button tool. Draw a rectangle around a background element, such as an arrow or pointer, if you created the PDF with such image elements.

2. Name the Button field in the Button Properties dialog box. I like to use goNext for buttons that advance forward a page and goPrev that move to previous pages. Try to avoid using the default names for fields that Acrobat provides, and supply a name that suggests what a button field does.

3. Set the Options. If you don't have a background design on a page that you want to use for page navigation, click the Options tab and add a button face to the button. Note that you can add a label (text) and image, or both in the Button Options tab. If using a background element designed in the authoring program before the file was converted to PDF, skip this step.

4. Add an Action. Click the Actions tab and choose Execute a menu item from the Select Action pull-down menu. Click Add and the Menu Item dialog box opens. Select View>Go To>Next Page as shown in Figure 1.

Figure 1: To add an action, click Add to open the Menu Item dialog box, then select View>Go To>Next Page.

Note that you can also use JavaScript to move to the next page. Use the Run a JavaScript action and type the following in the JavaScript Editor:

this.pageNum++;

5. Click OK in the Menu Item dialog box (or JavaScript Editor).

6. Duplicate the button. Assuming you want a button to move forward and a second button to move backward, press the Control key (Windows) or the Option key (Mackintosh), click and drag the button to duplicate it and move to the position where you want the second button to appear.

7. Change the button name. Open the Button Properties dialog box and change the button name in the General tab.

If you used an icon and/or text in the Options tab, make changes that reflect navigating back in your file.

8. Change the button action. Select the action in the Actions tab and click Edit. If using the Execute menu-item action, change the action to View> Go To> Previous Page. If using JavaScript, edit the script and change to:

this.pageNum--;

9. Duplicate the buttons. Select both buttons using the Select Object tool and open a context menu. From the menu commands, choose Duplicate as shown in Figure 2.

Figure 2: Select both buttons using the Select Object tool, open a context menu, and then choose Duplicate.

10. Specify the page range. The Duplicate Field dialog box opens. Click the From radio button and type 2 in the first text box. By default, the last page in your document should appear in the second text box (see Figure 3).

Figure 3: When you type a number in the first text box, the last page in your document should appear in the second text box by default.

11. Delete the unnecessary fields. The goPrev button on page 1 and the goNext button on the last page are dead. Click each of these buttons with the Select Object tool and delete them.

If you want the user to be able to loop the document, you can change the actions on the first and last buttons to open the last page and first page respectively. Use the Execute a menu item action or JavaScript for these two buttons. If using JavaScript, the code to open the first page is:

this.pageNum = 0;

The code for opening the last page in the document would be:

this.pageNum = this.numPages-1;

Add a legend

What may seem to you to be an intuitive icon for page navigation may not be as obvious to the recipients of your files. If using icons and images to mark areas where buttons are used, provide the user with a legend that clearly denotes the buttons and the actions performed by each.

Figure 4 is an example of such a document.

Figure 4: : If you use icons and images to mark areas where buttons are used in a document, provide the user with a legend that clearly denotes the buttons and the actions performed by each.

As previously mentioned, adding buttons for default views in Acrobat viewers is not generally necessary since the built-in tools for page navigation are displayed by default. These buttons are useful in documents when and where you want to hide toolbars and open files in full-screen mode, both which I will discuss in Part 2.

Read more Acrobat 8 tips from Ted Padova in the "Adobe Acrobat 8 PDF Bible," available from Amazon.