Copy link to clipboard
Copied
Hello,
I'm trying copy multiple comments from one PDF to the other, when they are pasted their orientation is at 90 same as the source. The orientation of the destination PDF is 270. How do I change the orientation of either pdf so they match?
Regards,
Acrobat is rotating your comments because the source page rotation is different from the target page rotation. You cannot change the page rotation (unless you do some heavy lifting and process each page element at a time, rotate it and then place it in the correct position), so the only way you can fix this is to rotate the comments after you place them - e.g. using the script that Try67 provided.
Copy link to clipboard
Copied
The question is whether the pages are actually rotated, or just appear to be... To check it you can execute this code from the JS Console and it will print the rotation degrees for all the pages in the file:
for (var p=0; p<this.numPages; p++) {
console.println("Page " + (p+1) + ": " + this.getPageRotation(p));
}
Copy link to clipboard
Copied
I have done this and confirmed that one page is set at 90 and the other at 270. So, how do actually rotate the page as apposed to the page just appearing to be rotated through the view>rotate drop down?
Thank you for your response.
Copy link to clipboard
Copied
You can do it manually via Tools - Pages - Rotate, or automatically, using this code:
for (var p=0; p<this.numPages; p++) {
if (this.getPageRotation(p)!=270) {
this.setPageRotations(p, p, 270);
}
}
Copy link to clipboard
Copied
The codes and procedures you have posted work as they are intended. However, when I import the comment data file or manually copy a comment from one PDF to the Other (or alternately page to page in the same PDF)
Acrobat DC is still rotating the comment 180 degrees!?
Copy link to clipboard
Copied
Acrobat is rotating your comments because the source page rotation is different from the target page rotation. You cannot change the page rotation (unless you do some heavy lifting and process each page element at a time, rotate it and then place it in the correct position), so the only way you can fix this is to rotate the comments after you place them - e.g. using the script that Try67 provided.
Copy link to clipboard
Copied
Thank you everyone for your help..........I was afraid that was going to be the answer. Well I'm off to copy and rotate one hundred + comments.
Copy link to clipboard
Copied
Ah, I missed one thing. Somehow I assumed that Try67's second code snippet was about rotating comments, which you can do using JavaScript as well:
var annots = this.getAnnots();
for (var i in annots) {
annots.rotate = 270;
}
This will rotate all annotations to use a rotation angle of 270 degrees. When you run this, you will notice that the rotated annotation is still using the same box as the original one, and therefore the actual annotation will very likely be smaller than the original. You also need to change the annotation rectangle accordingly to make this work correctly (and potentially change it's position). You would use the 'rect' property of the annotation: Acrobat DC SDK Documentation