2

I use Adobe Acrobat Pro 9 at work to edit a large number of scanned pdf documents. These are not OCRed. The information I need to quickly mail these documents out are on the first page, but my boss would like this page at the back. I can move the first page to the back using thumbnails, but this gets tedious with a large number of pdfs that are 20+ pages. So far, I am trying to modify a script I found from Bremen_Matt's post:

for (i = 0; i <= this.numPages/2-1; i++)
    this.movePage(this.numPages-1,this.numPages/2-i-1);

How to write javascript to reorder pages of a pdf document?

I can almost get it to work, but when I try:

for(i=0;i<=this.numPages/2-2;)
    this.movePage(this.numPages-1);

or

for(i=0;i<=this.numPages;i)
     this.movePage(this.numPages-1);

I wind up crashing the program. Do you have any thoughts? Thank you!

Community
  • 1
  • 1
  • 1
    In the last two "for" loops you are not incrementing the "i" variabile. You should add "i++" as third element in the "for" construct – ddb Aug 14 '16 at 21:04
  • Activate the Debugger in the JavaScript tab of the Preferences, and you will see error messages, which help you fix the code. – Max Wyss Aug 16 '16 at 06:07
  • @dbb I added the i++ operator in the third "for" parameter, which did allow the code to run. Unfortunately, the code did not seem to have any effect on the document: the first page remained on the first page. I wonder if there is something going on with the this.MovePage() arguments that need to be tweaked. – JackOConner Aug 19 '16 at 11:36
  • @Max Wyss I did enable the debugger in Acrobat, but the feedback can be hard to understand. I'm doing more research on "for" loops at http://www.w3schools.com/js/js_loop_for.asp. Finding the arguments for the this.MovePages statement is trickier because of a lack of documentation. – JackOConner Aug 19 '16 at 11:43
  • @JackOConner: The Acrobat JavaScript documentation is terse, but adequate (IMHO). The Acrobat JavaScript documentation is part of the Acrobat SDK documentation, downloadable from developer's section of the Adobe website. – Max Wyss Aug 19 '16 at 12:43

0 Answers0