These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Javascript or Batch processing

mterpeza
Registered: Jul 23 2008
Posts: 6
Answered

I'm attempting to setup a sequence within batch processing for acrobat 8. I work in the publishing field and produce pdf books ranging in 200+ pages, including covers. I'm looking to rename the first, and last two pages, with the prefix COV001, COV002,
COV003, COV004. Its pretty simple renaming the first two pages, however, it becomes a little more difficult as the last two pages are always different in page count. Is this something that would need to be done in java script? Thanks!

My Product Information:
Acrobat Pro 8.1, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You probably will need to use JavaScript. See the setPageLabels method of the doc object. You can get the total number of pages in the document with JavaScript via the numPages doc property, so you can know which page numbers to use when referring to the last two.

George
mterpeza
Registered: Jul 23 2008
Posts: 6
Thanks George for your input! I forgot to add that I'm not that familiar in writing java code. Would you happen to know a reliable source, or website that offers further help for someone like me? :)

Thanks again!
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
There may be some articles around here, so you might try a search.

Here's the seminal article on the subject: http://www.planetpdf.com/developer/article.asp?ContentID=Intro+to+Acrobat+5+Batch+Processing+&gid=6518You can e-mail me too.

George
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Here is the JavaScript you can use in a batch sequence:

// Starting with the first page (0), set up a page label
// with a prefix of "COV00" and a starting sequence number
// of 1
setPageLabels(0, ["D", "COV00", 1]);

// Remove any page labels for the subsequent pages
setPageLabels(2);

// For the last two pages, continue the naming scheme
setPageLabels(numPages - 2, ["D", "COV00", 3]);


Just set up a batch sequence and enter the code above in an Execute JavaScript command. The setPageLabels function is odd in that is doesn't let you specify a range of pages, but rather just the beginning page. That is the reason for the second statement.

George
mterpeza
Registered: Jul 23 2008
Posts: 6
Thank you so much for your help George! Very kind of you to share.

Cheers,
Mike