4 Replies Latest reply on Jul 24, 2009 9:32 AM by try67

# Trying to underline the rectangle of a Text Field

I am trying to underline the rectangle of a Text Field with a Line Annotation, but I am a little confused.

The first doubt is about the "Square" vs, the "Rectangle" annotations. What is the difference between them? Has Adobe changed those recently?

I have tried several variations of the following snippet:

var x1 = textField.rect[0];
var y1 =
textField.rect[1];
var x2 =
textField.rect[2];
var y2 =
textField.rect[3];

page: 0,
type: "Line",
rect: [x1, y1, x2, y1],
strokeColor: color.red,
strokeWidth: 160
});

What I am getting is an identity line (i.e., 45-degree) at the lower left corner.

-Ramon

• ###### 1. Re: Trying to underline the rectangle of a Text Field

The square rect defines top-left-x, top-left-y, bottom-left-x and bottom-left-y.

For a line it's left-x, left-y, right-x, right-y.

So if you want the line to be under the square, use the bottom values of the square to place the line.

• ###### 2. Re: Trying to underline the rectangle of a Text Field

Could you -or anybody else- please clarify this:

"The square rect defines top-left-x, top-left-y, bottom-left-x and bottom-left-y.

For a line it's left-x, left-y, right-x, right-y."

According to such definition, the square rect does not contain any information about the right side?

Maybe what you meant to write is:

"The square rect defines:

top-left-x, top-left-y, bottom-right-x and bottom-right-y.

For a line it is

left-x, left-y, right-x, right-y."

If that's the case, a rect of zero height is the same thing as a horizontal line. That was my assumption, but I am getting a 45-degree line through the origin.

TIA,

-Ramon

• ###### 3. Re: Trying to underline the rectangle of a Text Field

Yes, that's what I meant. Sorry for the mixup.

Maybe you should post your exact code.

• ###### 4. Re: Trying to underline the rectangle of a Text Field

The problem is this (from the Acrobat JavaScript Reference file):

"The Annotation Object also has a rect property. However, the coordinates are not in rotated user space and they are in a different order than in the Field Object rect property."