how to rotate a text box?

I am performing a review of a CAD drawing and wish to insert text boxes. I wish to rotate some of them 90 degrees. I also wish to change the color of the font and the size of the font but cannot.


Marc Pelletier


4 Answers

Voted Best Answer

If the text box name is Text1, this script will rotate the text to 90 degrees, change the text color to red, and change the font size to 14:

var f = this.getField("Text1");
f.rotation=90;
f.textColor=color.red;
f.textSize=14;


By David Dagley   

There is no user interface to rotate an annotation (e.g. a text box annotation), but you can do it via JavaScript. Bring up the JavaScript console (Ctrl-J or Cmd-J), then select the annotation you want to rotate and execute the following line in the JavaScript console:

this.selectedAnnots[0].rotate = 90;

This will rotate the selected annotation (assuming that there is only one selected). This can be done in a script that gets executed from a menu item or a tool button.

To learn about how to execute a JavaScript in the JS console, take a look here: https://acrobatusers.com/tutorials/javascript_console

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   

I thought you were talking about a text field. For a text annotation you can use this code to change the size and color of the text after you rotate it using Karl's script:

var spans=new Array();
spans[0]=new Object();
spans[0].textColor=color.black;
spans[0].textSize=12;
spans[0].text=selectedAnnots[0].contents;
selectedAnnots[0].richContents=spans;


David Dagley   

To change the color and size of text, you would bring up the properties toolbar (Ctrl-E or Cmd-E). Depending of what you've selected, you can either modify the properties of the box:

Text box properties (1)

Or, you can modify the properties of the text (e.g. font, size, color):

Text box properties (2)

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   


Please specify a reason: