tool to rotate text

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Mathew
User
Posts: 571
Joined: Thu Jun 19, 2014 7:30 pm

tool to rotate text

Post by Mathew »

It doesn't happen often, but sometimes I need to rotate just the text in text boxes. Usually it's after I've pasted from one drawing to another. It's easy with the right click menu to rotate everything, including the box. Sometimes I just want to rotate the text, so this script helps.

I just paste this into the console, and run it to create a temporary toolbar button. You could save it into the Javascripts folder if using often:

Code: Select all

// rotate text counterclockwise
app.addToolButton( {
	cName: "rotateTextTool",
	cLabel: "Rotate Text",
	cTooltext: "Rotate just the text CCW",
	cEnable: "event.rc = (this.selectedAnnots && this.selectedAnnots.length)",
	cExec: "for (let a of this.selectedAnnots) a.rotate += 90" }
);
If rotating clockwise makes more sense to you, change line 7 to subtract 90 degrees:

Code: Select all

	cExec: "for (let a of this.selectedAnnots) a.rotate -= 90" }
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 11031
Joined: Wed Jan 03, 2018 6:52 pm

tool to rotate text

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com