Showing posts with label buttons. Show all posts
Showing posts with label buttons. Show all posts

Friday, April 24, 2015

Adobe Acrobat: Buttons – Part 2

Finally, I continue to expound on what buttons can do in Adobe Acrobat Pro. Most of the functions I will cover are available in many versions of Adobe Acrobat prior to Pro. If you need a refresher on basic button functions, you should look up my first write up on buttons.

Of course, if you desire to follow along, then you will want to download the files I have prepared for this article.

So, this time we are going to begin making a set of buttons that will help us navigate a document without the use of windowed navigation features, such as the next and previous page buttons on the menu bar. This style of navigation buttons can be handy in some circumstances, such as a presentation-like document opened in full-screen mode, or without the window menus and such. (The current features of a navigation bar opening in a full-screen mode does already what we are going to do, but our exercise will help us gain insight in how buttons work anyway.)

So, begin by opening our main document, a small catalog of some dinosaurs.

our Dinosaur Catalog's initial page in an Acrobat Pro window

You will notice that I have also opened the Interactive Tool panel. This is our main access to the Button tool outside of the Forms panel.

Adobe Acrobat Pro's Interactive Objects' tools panel


Our first page is simply the title page, and will only be looked at initially. There is no need for a button here, but it will be nice to add an on-screen way to get to the next page, where we will build the set of buttons to use. To do this we will make a simple link.

So, first thing is to find the Link tool. It is in the Content Editing panel. Click on it and draw out a marquee surrounding the debossed area the title sits in. When it asks for what you want to do, leave it at “Go to a page view” and click OK. Navigate to the second page, where you can now click on the Set Link button in the floating dialog to set the link.

a screen shot of our Dinosaur catalog's initial page after drawing out the link marquee

the dialog box telling an Acrobat user to navigate to a page an set the Link



You may now go to the second page and select the Button tool. Along the bottom of the page, click and drag out a small area about 1-1/2 inches wide and under an inch high. You will notice the New Button dialog shows up. Click on its link to open the Properties dialog.

a drawn button marquee and its resulting Field Name flag
When it comes up, set the name of this button to “Previous_Page” and fill in the Tooltip to something  that tells the user to go to the previous page. Notice that the Common Properties on the bottom of this panel are for this form field to be Visible. That’s what we want at this time. If we had it Hidden, then the user would not be able to interact with it. One reason for using the Hidden setting will be given at a future installment yet.

Adobe Acrobat Pro button properties dialog General tab options

So next we progress to the Appearance tab. Here we simply want to set the background and border to None. We can ignore the Text settings, since we will not place any text in this button.

Adobe Acrobat Pro button properties dialog appearance tab options

We will ignore the Position tab, which is only found from Adobe Acrobat Pro XI and beyond, and move to the Options tab. Here’s where we begin to have some fun! We are going to use an icon for the appearance of the button. An icon is simply a graphic we create in some other application, such as Adobe Illustrator, to make the button look differently from what you can get from within Adobe Acrobat’s options (which aren’t much).

As long as you can export your graphic out to either a PDF, PNG or similar file format, then you should be able to use it in your PDF document. I wouldn’t recommend a JPEG file, because if you have a rounded corner or any non-rectangular shape, you will get a solid white background in your non-image areas. Luckily for this exercise, I have some buttons pre-made for us.

Adobe Acrobat Pro’s button properties'  dialog in the Options tab

So, drop down the Layout menu and choose Icon only from the list of options. Choose Invert for the Behavior for now. You will notice that so far there is only an “up” state for this button. Next, click on the Choose Icon button. Navigate to where you have the Buttons folder of these project files, and select the file called “left_arrow_wshadow_ylw-up.pdf” and click through the OKs. When you get back to the Button Properties dialog, you should see a yellow arrow graphic pointing left within your button marquee.

our first view of the previous page button

Next, click on the Advanced... button to get into the Icon Placement dialog. This feature controls the way your icon will look within the button field area. You have options for when to scale your icon, and for aligning your icon relative to the sides or center of the button field. For this button, choose Never for the scale, and we will keep the position centered within the button field.

the icon Placement dialog found after choosing the Advanced button


Now we have to add the all-important action. Click on the Actions tab, select Mouse Up as the trigger and Execute a menu item as the action. Click on Add... to find a listing of menu items. Here you see items that are in common with Adobe Acrobat Pro and Adobe Reader. It is up to 3rd party PDF software developers to allow these commands to be in common with their packages. Select “View > Page Navigation >  Previous Page” as your action.

a list of available menu commands in Adobe Acrobat



By the way, the field box properties dialog is pretty versatile in one way: it can remain open as long as you have the Button tool selected. You don’t have to close it when going from one button or form field to the next, just click on the next field you wish to modify and it will reflect the options of that selected field.

However, at this time we want to close the field properties dialog, because we want to test this button to see if and how it works! So click on Close and then choose the Hand tool in Acrobat’s toolbar. Click on your new button and your document should go to the previous page, the first page in this case. Congratulations! Now we can go back to the next page.

Now that you have one button, it isn’t hard to make another one! Choose the Select Object tool in the Interactive Objects pane and click on the Previous Page button field. Hold down the Option/Alt and Shift keys and drag it to the right. This should make a copy of this button field. Double-click on it to open the properties dialog.

a duplicate of the previous page button


Now, we can change the particulars of this button so it becomes the Next Page button. The reason for working from a copy of the other button is that many other aspects of it, such as the size of the box, the background, how we scale/size the icon graphic and so forth, are already established. We should only need to change a few things.

Go to the General tab and change the field name and tip to say Next page.

Go to the Options tab and click on Choose Icon... and navigate to the button graphic “right_arrow_wshadw_ylw-up.pdf” to select it as the icon for this button.

Then go to the Actions tab and select the Execute a menu item action. You will see an Edit button become available, which, of course, you should click on to bring up the list of menu commands to use.  Select “View > Page Navigation >  Next Page” as your action.

select the action to edit it while in the Properties dialog
Select the specific action to edit it.

Finally, we will copy one of these buttons to make a Home button, so you can go back to this intro page. Like before, select one of these buttons with the Option/Alt and Shift keys held down as you drag it over to the center of the group of buttons.

Double-click on it to bring up the Properties dialog and change the Name and Tip fields to Home.

Go to the Options tab and load in the next icon file, “home_button_ylw-up.pdf.” Resize the box to show the entire icon. Don’t worry about the position of the box just now.

In the Actions tab, delete the current action and drop down the Select Action menu to choose the Go to a page view option. When you click on the Add... button, the Set Link box will come up. Simply click Set Link to make the current page the destination.

Boy! We've done a lot here, but before we finish for this lesson (and leave you hanging for a while), we will do a little housekeeping on these buttons.

Use the Select Object tool to draw a marquee surrounding all three buttons. Then right-click on one of them to bring up a context-sensitve menu. As far as I know, this is the only access available for some of the functions you find on this menu. Find the Align, Distribute or Center menu and wait for the fly-out menu of options to show. Scroll over to the Distribute Horizontally to even the buttons out. Then choose that Align, Distribute or Center menu once more and find Align Horizontally to line them up on their vertical centers.

access to the Align, Distribute and Center menu options

There you have it, a set of navigation buttons to use in this wonderful PDF document. And now you can pride yourself in learning something more that Adobe Acrobat Pro can do with buttons.

Say again? We have to get these on the other pages? Oh. Well, we will have to take care of that in the next episode, as we have some other work to accomplish before that happens. Sorry to leave you hanging like that. See you back soon!

Monday, July 7, 2014

Adobe Acrobat X: Buttons - Part 1

A lack of PDF buttons

There is scarcely any aspect of Adobe Acrobat dealt with leaner than the idea of using buttons in a PDF document. If you do a web search for this topic, you will find very few articles, and most of them involve using JavaScript with the button actions, or they actually use LiveCycle Designer, which I don't get to use, because I am on a Macintosh. (Hey, LiveCycle Designer programmers, why don't you port that over to the Mac?)

So, I of course, aim to remedy this lack of information on Acrobat buttons and all the wonderful things you can accomplish with them.

For now it should be enough just to create a button and show how to get it to do something. Later we will try more and advanced stuff.

What you can do is follow along, if you download the sample working file(s) I have made available here. Otherwise, you are invited to create your own project as we go along.

Simple Button Creation

I will open a simple document of a few pages, with an indicator of the page number on each page. Nothing fancy.

our basic document for this demonstration


Another thing; I am using Adobe Acrobat Pro XI, so the placement of tools and items within your version of Adobe Acrobat may be different.

So, first step: find and choose the button tool. In Adobe Acrobat Pro XI it is found in the Interactive Objects tools pane. If you don’t see Interactive Objects, then go to the menu View > Tools > Interactive Objects. (Previous versions of Adobe Acrobat Pro may have the Button tool in the Content toolbox or elsewhere.)

Adobe Acrobat Pro XI's Interactive Object panel

Next, draw out a box about 1 inch wide and 1/2 inch high with the Button tool. You notice a pop up will show immediately with a field name of “Button1” and little else, except one text line in the bottom right corner saying “All Properties.” For now don’t click that.
the initial draw of the button tool

Of course, you’ll notice that the button is a field, for it says Field Name. Buttons are part of the whole form fields package that Adobe Acrobat Pro makes available. Because of this, a button has many uses  you may not even imagine yet. However, there are a couple of particulars you need to keep in mind because of this.

Number 1: as a field, each button should have a unique name given it. If any number of fields in a PDF file have the same name, the function of the PDF may get messed up, since the same data or function acted upon one field with that name, will be attached to the other fields with that name. The only exception would be the Radio Button form field, which we cannot spend time on right now.

A button field, though it doesn’t act like any other part of a form, will be recognized as a form element, and so the PDF file with only one button will be recognized as a form and may open with a menu bar for working with forms.

OK, back to our button. Now it’s time to click the All Properties link at the bottom of the big label box. This will open the Properties dialog. (If you have already clicked anywhere else in your document, you may have noticed the label box went away. That’s OK, you can get to the All Properties dialog by double-clicking on the button.)

a button with it's associated Properties dialog box

You see that the name of the button is selected here. Let’s rename it to say “Page2.” Hit your Tab key to move into the Tooltip field and type in “Goes to page 2.” The Tooltip gives the user a clue what the button (or any field) is for by showing your tip as the cursor hovers over the button. The Tooltip also acts as Alt Text for interactivity and compliance.

Next, select the Appearance tab to see the options there. You notice the fill color is currently a light gray (the default). Click on the little gray swatch next to the Fill Color label and choose something like a pure magenta. Depending on your operating system, you may have differing available color pickers.

The Text section sets your style of text in the label of the button, which is the text that shows up inside your button; this is only an option of course, you don’t have to have any text if you wish to keep your users guessing, or if prefer to use a graphic for your button otherwise (more on that some future time).

One quick note about the Font you choose. You will see a few fonts in the very top of your font list, with a line dividing these from your usual fonts list. These are the lowest common denominator fonts, meaning that everyone who opens your PDF file should have those fonts. It is best not to use fonts from below that line UNLESS you can guarantee every user of your PDF file will have those fonts available on their operating system.

Now choose the Options tab and observe the many possible settings you have available. For now just place your cursor in the Label area and type “To page 2.” When you hit the Tab key you should see your text appear in the button.

Acrobat button with Options tab properties

Now we have a button that is presentable to the user, except for one thing; we have to make the button do something! So, choose the Actions tab next. You may observe the straightforward options presented here. You have a Trigger to choose, and the drop-down list is filled with six possibilities. We will get to explain these in further excursions into Acrobat buttons, but for now, just leave it at Mouse Up.

the button properties Action tab Select Trigger menu dropdown

Suffice it to say that the Mouse Up option is the default behavior for just about any button in a computer application or web page. The action is triggered when you release the mouse button from the button, rather than on the click down. This allows a user the option to think twice about triggering the action, and to move the cursor away from the button before releasing it to avoid the action.

the button properties Action tab Select Action menu dropdown

So, now we get to say what we want to have happen. Drop down the menu for Select Action to see all the possible types of actions available. There are quite a number of choices, but for now scroll down a few to, “Go to a page view,” then click on Add....

You will see a little window come up with the instructions for creating a link. Navigate to page 2 of this PDF file and then click on “Set Link.”

Create link window


Now you may close the Properties box and select the hand tool. Click on your new button and watch it move to page 2 of the PDF file.

Congratulations! You now have a fully functioning button!