Building My Pizza PDF Form

Building My Pizza PDF Form
Howard Strauss
OIT – Princeton University
Copyright Howard Strauss 2003.This work is the intellectual property of Howard
Strauss. Permission is granted for this material to be shared for non-commercial, educational
purposes, provided that this copyright statement appears on the reproduced materials and
notice is given that the copying is by permission of the author. To disseminate otherwise or to
republish requires written permission from the author.
Overview
{
{
{
{
{
{
Build the Word document
Convert it to PDF
Add the fields and attributes
Add a reset and submit button
Try it!
Advanced topics – tabs, dates,
customized JavaScript
At www.princeton.edu/~howard/slides/pizzapdf
Build the Word document
WordArt title
Colored text
Radio buttons for positioning
Hidden table for alignment
with text and image
Visible table with text
Link to
www.pizza.com/history
View the Toolbars
Choose the View Menu
Select Toolbars
Check Standard,
Formatting, Drawing
and others you’d like.
View the Toolbars
Alternatively –
Right click anywhere on
the menu bar
Check Standard,
Formatting, Drawing
and others you’d like.
Build the WordArt Title
Choose the
WordArt Icon
Select a WordArt
style
Click OK
Build the WordArt Title
Enter your text.
Select the font, size,
bold, italic.
Click OK.
Use handles to resize object.
Position object (or rotate it)
using standard MS Word tools.
Add Colored Text
{
{
{
{
Enter and
position
text:
Select text
Use icon to choose color.
Viola!
Add Buttons for Positioning
{
{
{
Select the rectangle or oval tool.
Drag and hold down the shift key to
constrain to a square or circle.
Make buttons smaller than actual.
They will be covered over by PDF
buttons.
Add Invisible Table for Positioning
{
{
{
Choose Table, Draw Table.
Cursor will change to a
pencil.
Draw the outline of the box
by dragging the pencil from
corner to opposite diagonal
corner.
Add Invisible Table for Positioning
{
{
{
Use pencil to draw
vertical line.
Use pencil to draw
horizontal lines.
Approximate is ok.
Fill in text and temp
buttons. Set colors,
fonts, etc.
Get an Image
{
{
Use an image
you have or
use Google to
get one.
Be sensitive to others’ intellectual
property rights!
Insert the Image
{
{
{
{
Save the image – if you fetch one.
Position cursor in cell.
Choose Insert, Picture,
From File …
Browse for picture and
insert it. Resize image
if needed.
Reset picture
Set Transparent Color
Format picture
Text wrapping
Compress picture
Line style
Rotate left 90
Crop
Less bright
Brighter
Less contrast
More contrast
Color
Insert Picture
The Picture Tool Bar
Make Table Invisible
{
{
Adjust the cells as needed.
Select the table, right click, choose
Borders and Shading.
Make Table Invisible
{
{
Choose Borders tab, select None,
click OK.
Table is now
invisible. Gray
lines will not
display in PDF
form or print.
Add Visible Table with Text
{
{
{
Choose Table, Insert
Set number of rows
and columns. Click OK.
Enter text. Set font,
size, bold, and color.
Add Visible Table with Text
{
{
Select table, right click.
Choose Borders
and Shading.
Add Visible Table with Text
{
Set settings and click OK.
Add Visible Table with Text
{
{
Adjust cell size – if needed – by
holding down the mouse on a cell
edge and moving the edge.
The completed table.
Build a Hypertext Link
{
{
{
Select the text or image.
Choose the Insert Hyperlink Icon
Choose
Web Page,
Browsed
Pages,
enter the
URL and
click OK.
Convert the Word Document to PDF
{
Use the Acrobat Icon
in Word to convert to
PDF. Save PDF file.
Display the Acrobat 6 Toolbar
Zoom
Select area and copy to clip board
Button
Check Box
Combo Box
List Box
Radio Button
Text Field
Signature
Text
Zoom
Snap Shot
Pointer
Text touchup
Movie/sound
Crop
Link
Forms
Acrobat 6 Toolbar
Rotate Help Forms
Add a Text Field – General Tab
{
{
{
{
{
{
Select the Text Field Tool
Drag a rectangle.
Use General tab.
Set Name
Add Tooltip
Set Required
Add a Text Field - Appearance
{
{
{
{
{
Appearance tab.
Set Borders and
Colors.
Set Font Size.
Set Font.
Set Text Color.
Add a Text Field - Options
{
{
{
{
{
Options tab.
Set Alignment.
No Default Value
for Name.
No Check spelling
for Name.
Set other options.
Add a Text Field – other tabs
{
{
{
{
{
Actions tab not
often used for
Text fields.
Format tab.
Select None as
format category.
Validate and Calculate tabs not
often used for Text fields.
Click Close. Try it!
Add a Date Field
{
{
{
Select Text Field Tool, drag
rectangle, fill in General,
Appearance, Options, Actions,
Validate and Calculate tabs as for a
plain text field. Names are required
and usually are unique!
For Format tab,
choose Date
category and
mm/dd/yy option.
Try it.
Add a Time Field
{
{
{
Select text tool, drag rectangle, fill
in General, Appearance, Options,
Actions, Validate and Calculate tabs
as for a plain text field. Names are
required and must
be unique!
For Format tab,
choose Time,
h:MM tt or HH:MM.
Try it.
Add Radio Buttons
{
{
{
{
{
{
{
A group of radio buttons must have
the same Name.
Select the Radio Button tool.
Drag a rectangle.
Use General tab.
Set Name
Add Tooltip
Use Appearance
tab if needed.
Add Radio Buttons
{
{
{
{
{
{
For Options tab.
Choose Button Style.
Choose Export Value
– different for each
crust button.
Make Thin checked
by default.
Action tab rarely used for radio
buttons.
Do other buttons and try it!
Add Check Boxes
{
{
{
{
{
{
Select the Check Box tool.
Drag a rectangle.
Use General tab.
Set Name
Add Tooltip
Use Appearance
tab if needed.
Add Check Boxes
{
{
{
{
{
{
For Options tab.
Choose Check Box
Style.
Choose Export Value
of 1 for each check box.
No default.
Action tab rarely used
for check boxes.
Do other buttons and
try it!
Add Toppings Fields
{
{
Select Text Tool, drag rectangle, fill
in General, Appearance, Actions,
and Calculate tabs as for a plain
text field. Call fields thintop,
thicktop, siciliantop.
For Format tab,
choose Number
and set options.
Add Toppings Fields
{
{
{
{
{
{
{
For Options tab.
Set Alignment.
Set Default Value.
For Validate tab.
Choose range.
Set range to 0 to 3.
Build other
Toppings fields.
Add Unit cost Fields
{
{
Select Text Tool, drag rectangle, fill
in General, Appearance, Actions,
and Calculate tabs as for a plain
text field. Call fields thinunit,
thickunit, sicilianunit.
Set Read Only in
General tab.
Add Unit cost Fields
{
{
{
{
{
{
For Format tab.
Choose Number
and set options.
For Options tab.
Set Alignment.
Set Default.
Do other Unit cost
fields. Set unique
defaults.
Add Calculated Cost Fields
{
{
Select Text Tool, drag rectangle, fill
in General, Appearance, Actions,
and Validate tabs as for a plain text
field. Call fields thincost, thickcost,
siciliancost.
Set Format tab as for Unit Cost
fields.
Add Calculated Cost Fields
{
{
For Calculate tab, check Simplified
field notation.
Click EDIT.
Enter calculation using
field names and click
OK and Close. (+-*/
and parens)
Calculated Fields
{
Try it!
{
Do the other Cost fields.
Add a Reset Button
{
{
{
Select Button Tool and drag
rectangle at bottom of form.
For General tab.
Set Name and
Tooltip.
Add a Reset Button
{
{
{
{
For Appearance tab.
Set options.
For Options tab.
Set Label. This is
text for button.
Add a Reset Button
{
{
{
{
{
For Actions tab.
Choose Mouse Up.
Select Action: Reset
a form.
Click Add…
Select fields and
click OK.
Add a Submit Button
{
{
Select Button Tool and drag
rectangle at bottom of form.
For General tab:
z
{
{
Set Name and Tooltip.
Set Appearance tab.
Set button text in Options tab.
Add a Submit Button
{
{
{
{
{
{
{
For Actions tab.
Choose Mouse Up.
Select Action:
Submit a form.
Click Add…
Enter URL.
Choose HTML.
Click OK.
http://www.princeton.edu/
cgi-bin/Princeton/[email protected]
Advanced Acrobat Topics
Dealing With Tab Order
{
{
{
{
Fields will tab in the order they are
created – by default.
Add a field out of order and you
may want to change this.
Tab order is set for each page.
Choose (for each page)
z
z
z
z
Row order
Column order
Document structure
Unspecified (default)
Tab Order
{
{
Click Pages tab.
Page thumbnails
will display.
Tab Order
{
{
{
Select the page.
Right click a page
thumbnail.
Select Page
Properties…
Tab Order
{
{
Choose row, column,
or unspecified
(document structure
is very advanced).
Repeat this for each
page.
Custom Tab Order
{
{
{
{
Supported in Acrobat 5
Not supported in Acrobat
6.0
Must use Acrobat 6.0.1 or
later!
Use Help menu – then
About Acrobat to check
version and Updates… to
get latest updates.
Custom Tab Order
{
{
Ensure that you have Acrobat 6.0.1
or later.
Ensure that a custom tab page has
Unspecified tabs selected.
Custom Tab Order
{
Select Tools,
Advanced Editing,
Select Object Tool
Custom Tab Order
{
{
All Form Objects will
be selected.
Right click on any
one and select Set
Tab Order.
Custom Tab Order
{
Each form object
will be
numbered.
Custom Tab Order
{
{
Click on the
objects in the
order you want
the tabs to work.
The first object
you click on will
tab first.
Click anywhere
outside an object
when you are
done.
Add a Today’s Date Field
{
{
{
Select a Date
field.
Choose Custom
calculation
script on
Calculate Tab.
Click Edit…
Add a Today’s Date Field
{
{
Insert this in a custom calculation
event.value = util.printd(“mm/dd/yy”, new
Date () )
z mm/dd/yy or dd/mm/yy or
mmm dd yyyy – and others.
Add a Today’s Time Field
{
{
{
Select a Time
field.
Choose Custom
calculation
script on
Calculate Tab.
Click Edit…
Add a Today’s Time Field
{
Insert this in a custom calculation
event.value = util.printd(“h:MM tt”,
new Date () )
{
A few other printd values
{
z
z
z
z
mmm – Oct – short month
ddd – Tue – short day
yyyy – 2004 – long year
HH – hours in 24 hour time
Add an Invisible Calculated Field
{
{
{
{
{
{
Select the Text Field Tool.
Drag a rectangle.
Set Read Only in General tab.
Set Hidden.
Tooltip will not
display while field
is hidden.
Set other tabs as
needed.
Add an Invisible Calculated Field
{
{
{
Set Simplified field notation in
Calculate tab. Click EDIT.
Add up the check box fields Export
Values. Each should be set to 1.
Toppings field will have the number
of toppings selected.
Add an Invisible Calculated Field
{
If the toppings field were visible,
here’s how it would look:
Add a Custom JavaScript
{
{
{
{
The Cost is the Unit cost multiplied
by toppings – our invisible field.
But we have three different costs –
one for Thin, Thick, and Sicilian.
We’d like to calculate only one cost
– based on which crust is selected –
and have the others set to zero.
For no toppings – for now – the
pizza is free.
Add a Custom JavaScript
{
How to do this:
z
z
z
Put toppings into field thintop (the field
under Toppings on the first row) if
thin crust (the radio button) is
selected, otherwise set thintop to 0.
Put toppings into field thicktop if thick
crust is selected, otherwise set thicktop
to 0.
Put toppings into field siciliantop if
Sicilian crust is selected, otherwise set
siciliantop to 0.
Add a Custom JavaScript
Add a Custom JavaScript to thintop
1
2
5 – Enter custom script here.
3
4
The JavaScript Script
The Script Explained
var crust = this.getField("crust")
var toppings = this.getField("toppings")
var thintop = this.getField("thintop")
• For each field that you need to use,
enter a statement of the form:
• var myfield =
this.getField(“myfield”)
• Case is critical!
• This makes the fields available to your
script.
The Script Explained - IF
if (condition)
{
do this
}
else
{
do that
}
If the condition is
TRUE then do the
script at do this. If
the condition is
NOT true then do
the script at do
that. If the do that
script is a single
statement, then
the { } are
optional.
The Script Explained
if (crust.value == "thin")
{
thintop.value = toppings.value
}
else thintop.value = 0
• myfield.value is the current value of
myfield
• a.value = b.value means change the
value of a to the value of b
• crust.value == "thin“ is TRUE if the
value of crust is “thin”
The Other Two Scripts
For More Information
{
{
{
{
www.princeton.edu/~howard/slides
/acrobat
[email protected]
(609) 258-6045
Adobe Acrobat 6 PDF Bible – Ted
Padova