Understanding Acrobat VBA Text Field Coordinates and the Rect Array in PDF Forms
Question details
The user needs to understand how to correctly define the rectangle array coordinates (left, top, right, bottom) when inserting a text field into a PDF form using Acrobat JavaScript or VBA.

- Product
- Adobe Acrobat PDF Forms
- Device & OS
- not provided
- Scenario
- Programmatically adding text form fields to a PDF document using VBA or JavaScript scripting.
- Observed behavior
- Requires proper calculation of the Rect Array, recognizing that PDF coordinate systems utilize points and generally start from the lower-left corner of the page.
Before scripting your form fields, verify your document's exact page dimensions in points (1 inch = 72 points) to accurately calculate the origin and placement boundaries.
Calculate and Define the Rect Array for PDF Fields
Properly calculate and input the left, top, right, and bottom points into the AddField method to correctly position and size your text field.
In PDF manipulation using Acrobat VBA or JavaScript, the document coordinate system dictates that the origin (0,0) is typically located at the lower-left corner of the page.
The rect array is formatted strictly as Array(left, top, right, bottom). The overall width of your text field is determined by subtracting the left coordinate from the right, and the height is calculated by subtracting the bottom coordinate from the top.
Decide on the exact width and height in points you want your text field to be. Ensure your measurements reflect the standard 72 points per inch rule.
Establish the left, top, right, and bottom points based on the lower-left origin point of the specific PDF page box.
In your script's AddField method, define the field's location using the Array format. For example, writing Array(416, 902, 800, 600) places the field strictly within those predefined coordinates.
Run your macro or script to generate the PDF field. Open the resulting PDF to confirm the text field sits perfectly in the intended location.

Edit and Manage PDFs Visually with WPS Office
If calculating complex point arrays via VBA is too time-consuming, WPS PDF provides an intuitive, user-friendly interface to add, edit, and fill PDF forms visually without writing a single line of code.
- 1. Open your PDF document: Launch WPS Office and open the PDF file you wish to modify.
- 2. Access the Edit tools: Navigate to the 'Edit' or 'Form' tab located on the top ribbon.
- 3. Insert fields interactively: Select the text box or form field tool, then simply click and drag to your desired location on the page to set the boundaries automatically.

Frequently Asked Questions
Why is my PDF form field appearing off the page or in the wrong position?
This commonly occurs because PDF coordinates originate from the lower-left corner, not the top-left. If you calculate your coordinate points assuming a top-left origin, the field will be misplaced or inverted. Always verify that your math accounts for the lower-left starting point.
How do I convert inches to the points used by the Acrobat Rect array?
PDF coordinates rely on points, where 1 inch is equal to exactly 72 points. To convert, multiply your inch measurement by 72. For example, positioning a field 2 inches from the left edge requires setting the left coordinate to 144 points.
Where can I find full documentation on the Acrobat Field object properties?
You can find comprehensive details about the Field object, including detailed breakdowns of the rect property and page boundary behaviors, in the official Acrobat JavaScript API Reference provided by Adobe.




