Skip to main content
Inspiring
February 12, 2018
Answered

How do I rotate the text inside of a text field with JavaScript ?

  • February 12, 2018
  • 1 reply
  • 4832 views

Hi,

I'm using Acrobat Pro DC 2015 Release.  I created a text field (using this.addField) then I attempted to rotate the text using the rotation property.  I've tried rotations of 90,  180, and 270, but the text never rotates.  If I bring up the properties dialog for the text field, which has a "Orientation" pulldown menu under the General tab, I can easily rotate the text by 90, 180, and 270 degrees.

I know that the text box doesn't rotate, I only want to rotate the text inside of the text box.  I've tried this with two different text boxes in my program but I can never get the text to rotate.  When I look at the text box properties dialog, specifically the "Orientation" pulldown, it never reflects what my program is attempting to do -- it always stays at 0 degrees.

With any text field and as you know, there are numerous text properties one can set -- textFont, textColor, textSize, readonly, value, etc.  Is there some requirement whereby the rotation property has to be set AFTER all of the other properties have been set?  I've tried moving the rotation property around in my program relative to the other text properties, but I still can't get my text to rotate.

BTW, my page is in landscape mode.  I haven't done anything in my program to reflect this orientation -- do I need to do something to tell Acrobat my page is in landscape mode?

Thanks for any suggestions anyone has.

Dave

This topic has been closed for replies.
Correct answer try67

The page size is irrelevant. My guess is there's something wrong with your code. Can you share the code you used to do it, as well as the file? You can upload the file to a website like Dropbox, Google Drive, Adobe Cloud, etc., and then post the link to it here.


I created a file that demonstrates how to rotate a field, and how to read the field's current rotation: Field rotation test.pdf - Google Drive

1 reply

Bernd Alheit
Community Expert
February 12, 2018

What do you use to rotate the field?

DHeadrickAuthor
Inspiring
February 12, 2018

Hi Bernd,

As mentioned in my post, I'm using the rotation property.  For example, MyTextFieldVariable.rotation = 90

Is this correct?

Thanks.


Dave

DHeadrickAuthor
Inspiring
February 12, 2018

This is correct.


.I'm confused.  What does the rotation property affect if it doesn't affect the text itself?