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

PDF Batch Processing, JavaScript

Gio6488
Registered: Sep 12 2007
Posts: 4

I am starting out with this. My objective is to run
a Acrobat batch script to sort by Layered and not layered hopefully target dir
to save output file accordingly.
While I am in there Turn a Layer default off.
My layer off is working. I need to run this unattended with
 
success confirmation and
Error handling and
Append all to 1 report.
 
Currently I get 1 per file and have not worked out the sort/save
 
Any help would be appreciated
 
/* Lyr RPT Mod Test */
var rep = new Report();
rep.size = 1.2;
rep.color = color.blue;
rep.writeText ("Testing for Content");
rep.writeText("FileName : " + this.documentFileName);
for (var i = 0; i < this.numPages; i++ ) // loop thru all pages
{
var a = this.getAnnots();
var c = this.getOCGs();
var b = this.getPageBox("Crop", i);
var l = this.getLinks(i, b);
var ocgs = this.getOCGs();
for (var i=0; i

My Product Information:
Acrobat Pro 8.0999999999999996447286321199499070644378662109375, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You code was cut off. Please repost with all the "less than" and "greater than" symbols replaced by lt and gt. I have to warn you though that this is not a free consulting service. We give general advice and answers to specific questions. We do not analyze code. Here's some general advice.

If your current algorithm is working then you can use it in a batch process, although the methodology is a bit awkward. You'll need to separate the parts of the code that create and finish the report from the code that operates on the documents. Place this code in two separte menu items or toolbar buttons. Change the code so that the Report object is assigned to a "Global" variable. If your on Acrobat 8 you will need to set the JavaScript preference that allow the Global object to be used accross documents.

The sequece for using the batch script is:

1. Execute menu item that sets up Report Object.
2. Run Batch Process
3. Execute menu item that finishes off report.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script