Copy link to clipboard
Copied
Hello, reaching out before I fall completely down the rabbit hole.
I have a script that downloads puzzles and comics daily. I have one puzzle that when downloaded, needs to be placed 90CCW. A sample of the code i'm trying is here:
// LA TIMES SUNDAY
if (pageItem.label == "LA_TIMES_SUNDAY_CROSSWORD")
try{
name = "20" + myDate.text + "pzsxw-a.tif"
var myFile = new File(imagePath+name);
if (myFile.exists)
{
pageItem.place(myFile);
pageItem.rotationAngle = 90;
// pageItem.fit(FitOptions.CONTENT_TO_FRAME);
}
This works but it moves my frame way up and resizes it. Any ideas how I can only have the image rotate within the frame, keeping everything else in the template static?
Hope this makes sense.
Doug
Hi Doug
You can use
var tm = app.transformationMatrices.add(undefined, undefined, undefined, 90);
pageItem.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, tm);
instead of
pageItem.rotationAngle = 90;
HTH
Trevor
Copy link to clipboard
Copied
Hi Doug
You can use
var tm = app.transformationMatrices.add(undefined, undefined, undefined, 90);
pageItem.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, tm);
instead of
pageItem.rotationAngle = 90;
HTH
Trevor
Copy link to clipboard
Copied
Easier to remember is
app.layoutWindows[0].transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
pageItem.rotationAngle = 90;
Copy link to clipboard
Copied
Thanks so much Trevor.
Worked like a charm!