New PDF Form Field: Text Form Field
(See Example PDF and Example PDFill Project File )
A Text PDF field is a box or space in which the user can enter text from the keyboard. It is the most commonly used form field, as it creates plain text fields in which the user can type his name, address and so on.
You often use unique field name When creating a text form field. If you use the same name for more than one field, data typed in the field box is replicated for all fields with the same name.
You can format a text field in a number of different ways to insure that fields are completed properly. By using the following option Tabs, you can add actions, format scripts, data validation and calculations:
1. Steps on how to create a Text PDF Form Field:
or click Text Field Tool in the Forms Toolbar.
2. To access form field properties:
3. Set Field Properties:
3.1. General Tab
Field Name The name to define the field. Two fields can have the same name and they will have the same value string. It is case-sensitive. Show PDF Form Field's Name Click this option to show PDF Form Field's Name Tooltips Inside Adobe Reader, the user hovers the cursor over the field, without clicking it, and a small box appears with supplementary information regarding the field being hovered over. This is useful to help the user fill the form. Visibility Visible: Display and Printable.
Hidden: do not display or allow it to interact with the user and not can not print.
Visible but Don’t Print: don’t print this field even if it is displayed on the screen.
Hidden but Printable: even if it is not displayed, it will print on the page.
Rotation The text direction inside the box: 0, 90, 180 or 270. Read Only If set, the user may not change the value of the field. Any associated widget annotations will not interact with the user; that is, they will not respond to mouse clicks or change their appearance in response to mouse motions. Required If set, the field must have a value at the time it is exported by a submit-form action (see “Submit-Form Actions” on page 662). Font Size If set 0, the font size will be adjusted automatically according so that all the text will be fitted into the box. Font Color The color of the text. Font Encode Click here to see the listed links to international graphical representations, and textual listings, of each of the Windows codepages that PDFill supports. Font Name Some font is empty for the selected Font Encode. You must play with several fonts to see if it works inside PDFill. Font Style Font Regular, Bold, Italic and Bold Italic. Font Embed Font Embedding allows the fonts used in the creation of a PDF form to travel with that PDF document, ensuring that a user sees PDF Form Fields exactly as the designer intended them to be seen. But, it requires bigger PDF file size. There are 3 options: Auto, NOT Embedded and Embedded.
Note that If your special font is copyright-protected, the font embed will not work.
Show New Text Form Field's Property Dialog If unchecked, the Property Dialog will not be shown when a new text form field is created.
3.2. Appearance Tab
Fill Color The background color of the field, If set, it will be opaque. Border Width The line thickness of the border. Select a width greater than 0 to enable the Border color and style Border Color The color the border line. Border Style Solid: a solid rectangle surrounding the annotation.
Dashed: a dashed rectangle surrounding the annotation.
Beveled: a simulated embossed rectangle that appears to be raised above the surface of the page.
Inset: a simulated engraved rectangle that appears to be recessed below the surface of the page.
Underline: a single line along the bottom of the annotation rectangle.
Position (Left, Right, Top, Bottom) The X and Y coordinate of the box to define the position of the field. Adjust Box Height using Font Size The height of the box will be adjusted according to the font size
3.3. Options Tab
Alignment Text Alignment inside the box: Left, Center and Right. Max Chars The maximum length of the field’s text, in characters. If 0, there is no limit. Default Value A reset-form action resets the entire interactive form fields to their default values. When the user submits the form, if this field is not filled, this value will be submitted; Multiple Line Text If set, the field can contain multiple lines of text; if clear, the field’s text is restricted to a single line. Password If set, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard should instead be echoed in some unreadable form, such as asterisks or bullet characters. To protect password confidentiality, viewer applications should never store the value of the text field in the PDF file if this flag is set. No Scroll Long Text If set, the field does not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted. No Spell Check If set, text entered in the field is not spell-checked. File Selection If set, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field. Combo of Max Characters Spread the user-entered text evenly across the width of the text field.
If you need more details, see PDF Reference's Text Field on Page 653.
You can add multiple actions. See PDF Actions
- Open a Web Link
- Reset a Form
- Submit a Form
- Named Action
- Go to Local Page
- Go to Another PDF
- Launch Application or Document
3.5. Format Tab
The following scripts and formats can be used for the format and keystroke triggers. Please see details:
Acrobat Forms API Reference: http://www.pdfill.com/download/FormsAPIReference.pdf
Functions Variables Example Display Example Code (Don't Miss ; ) AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)
AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)
– nDec is the number of places after the decimal point;
– sepStyle is an integer denoting whether to use a separator or not. If sepStyle=0, use commas. If sepStyle=1, do not separate.
– negStyle is the formatting used for negative numbers: 0 = MinusBlack, 1 = Red, 2 = ParensBlack, 3 = ParensRed
– currStyle is the currency style - not used
- strCurrency is the currency symbol
$12,123.03 AFNumber_Format(2, 0, 3, 0, "\u0024", true);
AFNumber_Keystroke(2, 0, 3, 0, "\u0024", true);
– nDec is the number of places after the decimal point;
- sepStyle is an integer denoting whether to use a separator or not. If sepStyle=0, use commas. If sepStyle=1, do not separate.
32.24% AFPercent_Format(2, 1);
– cFormat is one of: "m/d", "m/d/yy", "mm/dd/yy", "mm/yy", "d-mmm", "d-mmm-yy", "dd-mmm-yy", "yymm-dd", "mmm-yy", "mmmm-yy", "mmm d, yyyy", "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM" 04/13/2010 AFDate_FormatEx("mm/dd/yyyy");
– ptf is the time format: 0 = 24HR_MM [ 14:30 ], 1 = 12HR_MM [ 2:30 PM ], 2 = 24HR_MM_SS [ 14:30:15 ], 3 = 12HR_MM_SS [ 2:30:15 PM ] 14:30:15 AFTime_Format(2);
– psf is the type of formatting to use:0 = zip code, 1 = zip + 4, 2 = phone, 3 = SSN 123-45-6789 AFSpecial_Format(3);
Example: (Don't Miss ; )
AFNumber_Format(2, 0, 0, 0, "", false);
AFNumber_Keystroke(2, 0, 0, 0, "", false);
3.6. Validate Tab
AFRange_Validate(bGreaterThan, nGreaterThan, bLessThan, nLessThan)
- bGreaterThan - logical value to indicate the use of the greater than comparison
- nGreaterThan - numeric value to be used in the greater than comparison
- bLessThan - logical value to indicate the use of the less than comparison
- nLessThan - numeric value to be used in the less than comparison
Example: AFRange_Validate(true, 0, true, 100);
3.7. Calculate Tab
– cFunction is one of "AVG", "SUM", "PRD", "MIN", "MAX"
– cFields is the list of the fields to use in the calculation.
Example: AFSimple_Calculate("SUM", new Array ( "Text1", "Text2", "Text3" ) ); //SUM (Don't Miss , and ; The field name is case-sensitive)
AFSimple_Calculate("PRD", new Array ( "Text1", "Text2" ) ); //Multiply Text1 and Text2
You can also use custom script like this:Please save your PFL into a new PDF to see the effect of calculation. If you have problem to build a complicated form with calculation, please have a blank PDF project and test a simple calculated form fields first.
var a = this.getField("Text1").value; //It is getField not getfield
var b = this.getField("Text2").value;
this.getField("Text3").value = 10 * a - b/10; //Custom Calculation
this.getField("Text4").value = "All Values = " + a + " and " + b; //Concatenate Field Values
When you define two or more calculations in a form, the order in which they are carried out is the order in which you defined the calculations. In some cases, you may need to modify the calculation order to obtain correct results. Please see detail in Calculation Order.
PDFill Copyright © 2002-2017 by PlotSoft L.L.C.. All rights reserved.