Showing posts with label PDF. Show all posts
Showing posts with label PDF. Show all posts

Friday, 26 April 2013

Navigation Button Tricks for Interactive PDF on an iPad


When I’ve been working on creating interactive PDFs that will be viewed on an iPad, I’ve been frustrated by the immature applications available for reading and working with PDFs. I’ve written about this in the past year before here and here.
One of the most maddening problems was just getting simple navigation buttons (Next Page, Previous Page, etc.) to work properly. If you create navigation buttons in InDesign CS6, they work fine in Acrobat Pro or Reader for Macintosh or Windows, but they do nothing when you click on them in Adobe Reader on the iPad. Another problem is that, even with PDF Expert, a paid PDF reader app I recommended in the postings above, the buttons work, but the text for the buttons doesn’t display properly.
Creating Navigation Buttons in Acrobat
An Acrobat expert, George Johnson, explained the problem with navigation buttons creating in InDesign CS6 not working in Adobe Reader, in a posting on the Adobe Reader for iOS forum:
The problem with InDesign is in using the Go To Next/Previous Page options in InDesign, it creates an Execute a Menu Item action when exported to PDF, and since Reader for iOS doesn’t have menu items or interprets such actions otherwise, they are just ignored.
When I first created some navigation buttons in InDesign CS6 like those shown below, the Go to Destination action and Go to URL actions worked in Adobe Reader for the iPad, but the First Page, Previous Page, Next Page, Last Page buttons did not.
Navigation Buttons in InDesign
Navigation Buttons in InDesign
If you examine the buttons that don’t work in the Forms Editing feature of Acrobat Pro, like the Next Page button shown below, the PDF sees the navigation command as a menu command. This is a menu which appears in Adobe Reader and Acrobat for the Macintosh and Windows, but not on an iPad.
Buttons Viewed in Acrobat Pro
Buttons Viewed in Acrobat Pro
The workaround is to create those buttons in Acrobat. This requires a different workflow. Here’s what I did that works in Adobe Reader:
1. Instead of placing the navigation buttons on a master page, I created the four buttons (First Page, Previous Page, Next Page, Last Page) only once, and I placed them at the bottom of page 1. I didn’t give the buttons an action. (The other buttons can be created with actions in InDesign.)
2. I exported to PDF (Interactive) and opened it in Acrobat Pro. In Acrobat Pro XI, I chose Tools > Forms > Edit. In the Forms Editor, I right-clicked each of the four buttons on page 1 of the PDF, to bring up a contextual menu and chose Duplicate Field, and chose to duplicate the buttons on each page of the PDF.
Duplicating Buttons Across Pages
Duplicating Buttons Across Pages
3. Then for each button, I created an action in Acrobat Pro which created the navigation to the desired page. I double-clicked on each button. On the Actions tab of the Button Properties dialog, I selected a Go to a Page View action.
Go to Page View Action
Go to Page View Action
4. After choosing the action, I was prompted to navigate to the destination page as shown below.
Creating Page View
Creating Page View
5. The resulting PDF, when transferred to Adobe Reader on the iPad, worked perfectly.
Viewing the Buttons on an iPad
Viewing the Buttons on an iPad
Be aware that Adobe Reader still does not support Show/Hide buttons, nor does it support video or audio files.
Another Workaround for PDF Expert
Readdle’s PDF Expert, which I’ve written about before, has a different kind of limitation with buttons created in InDesign CS6. It has apparently created its own workaround for the navigation buttons which doesn’t require using Acrobat Pro. While the buttons work to navigate, you can’t read the text labels on the buttons! For PDF Expert, the workaround is to outline the type which is contained in the button. The screen capture above was created in PDF Expert after using that workaround.

PDF tricks


Tips and Tricks for Creating PDF Buttons
The following list isn’t exhaustive, but, no doubt, those reading it can suggest some other tips:
1. When possible, create buttons on master pages in a document. This will greatly reduce the number of buttons you need to create, and will ensure consistency.
2. Buttons can have different attributes for visibility and printability. In the PDF language, buttons are considered a kind of field (think form fields). Fields can have four variations of visibility—Visible in the PDF, Visible in PDF but Doesn’t Print, Hidden in PDF, and Hidden in PDF but Printable. You can choose which of these attributes are applied to a button from the Button panel menu. Most buttons are Visible in the PDF but each of these options has their uses.  (Example: If you want a picture to appear when you click a button, create two buttons. Place the picture in a Hidden button, and use the Show/Hide Button action in the Visible button to make the picture visible.)
Button Panel menu
3. Buttons only “come alive” in an interactive PDF file if you turn on the right options when you export your PDF. (Forget trying to create a PDF using Distiller; that kills everything.) In the Export PDF dialog, be sure to check Interactive Elements (and also check Hyperlinks if you’re using those in your interactive PDF file).
PDF Export options
4. If you’re using transparency in your document and it in anyway interacts with a button, you must save your file with Acrobat 5 compatibility or higher (no transparency flattening). Otherwise, you’ll get the message below, and you’ll lose your interactivity:
Choose Acrobat 5 or later
Creating a Go to Page Button in a PDF File
As I mentioned in the previous posting, there is a Go to Page action in the Button panel in InDesign CS4, but it’s only for creating buttons to be exported as a SWF file. So how do you create one in a PDF file? You need to create a text anchor, and use the Go to Anchor action. (As we’ll see, these have a different name—named destinations—in Acrobat.) Here’s how to do it:
1. Go to the destination page, and select text in a text frame. (You could make text Paper color to hide it if you don’t want it to be visible.)
2. Open the Hyperlinks panel (Window > Interactive > Hyperlinks). Choose New Hyperlink Destination from the panel menu. By default, it names the text anchor it creates using the text string you selected, although you could rename it.
Create Text Anchor
3. Make a button, and make its action Go to Text Anchor. Select the text anchor you created.
Select Text Anchor
When an interactive PDF is created, that should create a named destination that the button will select, jumping to the appropriate page.
Button Troubleshooting in Acrobat
We’d expect that all the buttons we create in InDesign would create perfect buttons in Acrobat. Unfortunately, many things can go wrong. In fact, as I was preparing this posting, I ran into one myself. So I’ll use it as an example of how to troubleshoot buttons in Acrobat. When I created a text anchor as I described above and made a PDF, all my buttons worked correctly except that one. As of this writing, I’m not sure what happened (my colleague and friend Sandee Cohen wasn’t able to replicate the problem). I did the requisite troubleshooting (like restoring my InDesign preferences) but the problem persisted. The method worked correctly in InDesign CS3 so it could be a subtle InDesign CS4 bug.
I opened up Acrobat to see what was going wrong. Acrobat has had its own interface for creating and editing buttons for many versions. In many ways, it can create buttons which are more complex than those that can be created in InDesign so it’s worthwhile to learn how it works.
I worked in Acrobat 9 Pro which now has a special form editing mode, and I’ll give the steps I followed, but I’ll also describe how I could use Acrobat 8 Professional as well. I ended up editing the named destination (text anchor).
1. Choose Forms > Add or Edit Fields (In Acrobat 8 Pro, choose Forms > Edit Form in Acrobat.)
2. Find the button which is not working. You can use the Fields panel at the left to help identify it, if necessary. Double-click the button. (In Acrobat 8 Pro, the Forms toolbar opens. Click the Button tool, and double-click the problem button.)
3. The Button Properties dialog box opens. Click the Actions tab.
Acrobat 9 Button Properties
4. In the Actions section at the bottom, select Go to a page in this document. Click the Edit button.
Editing the Named Destination
Now you can see that the text anchor (now called a Named Destination) is embedded in the PDF file. Browse to reselect it again, and click OK.
5. Close the dialogs. Click Close Form Editing (Acrobat 9 Pro only).
After reselecting the destination, the button worked fine.
What if you needed to create a new destination in Acrobat? You’d use Acrobat’s Destinations panel. Here’s how:
1. Choose View > Navigation Panels > Destinations
2. Navigate to the page you’d like to make the destination.
3. Choose New Destination from the Action popup menu (gear icon).
Acrobat Destination Panel
A new destination is created. You’re given the opportunity to name it. It’s set to the page you’re currently viewing.
4. Edit your button to select the new destination you created.