Explanation of textbox rect dimensions

Posted on 2005-05-13
Last Modified: 2011-08-18
The following code snippet creates a textbox on a pdf:

Set jso = PDDoc.GetJSObject
rect(0) = 100  ' x lower left
rect(1) = 100  ' y lower left
rect(2) = 300  ' x upper right
rect(3) = 200  ' y upper right

' add a form field
Set field = jso.addField("myFormField", "text", 0, rect)

Can someone provide me with a more detailed explanation of the coordinates for 0-3?  For some reason, I'm drawing a blank here, and it's not abundantly clear in any of the Adobe help docs.

Question by:Jim Horn
    LVL 44

    Accepted Solution

    After reviewing the code, I noticed that I screwed up in my comments (because Adobe broke their own rules :-)
    The individual elements are (and this is a quote from the Acrobat Javascript Scripting Reference): "upper-left x, upper-left y, lower-right x and lower-right y". In all non-JavaScript rects that are described in the SDK, they use lower left corner and upper right corner.... And not even the JavaScript rects are consistent: Rects for annotations are different again AAAAARRRRRGGGGGHHHHHH... :-)

    All coordinates in PDF (and PostScript) are expressed in points. One point is 1/72".

    If you want to create a text box with an upper-left corner that is two inches from the bottom of the page (all coordinates are relative to the lower left corner of your page), and one inch from the left edge, is 3 inches wide and 1/2 inch high, you would use the following code:

    rect(0) = 2 * 72  ' x upper left
    rect(1) = 1 * 72  ' y upper left
    rect(2) = 300 * 72 ' x lower right
    rect(3) = 0.5 * 72  ' y lower right

    Does this make more sense now? I'm sorry for the wrong information that I posted earlier.
    LVL 65

    Author Comment

    by:Jim Horn
    Makes sense.  I was able to stumble my way through testing this a couple of days ago.  


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
    This article focuses on how to remove password security from multiple PDF files by Adobe Acrobat program. Sometimes it is essential to access the stored data items and to print, edit as well as copy content from Portable Document Format files in abs…
    In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…
    In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now