Scripting Acrobat

kaiserwilhelm

Well-known member
Imagine a PDF with 27 layers.
Common LITHO layer one
XXX_A layer 2
XXX_B layer 3, etc to _Z

PAINFUL to go into each PDF and tell each of the 25 layers that I do not want to "not print", etc.

Can I script Acrobat to turn off all but _J for example?
Going to post into Pitstop forum as well
 
Hello,

I see from the PitStop forum you solved this with colour names as ABC says PitStop does not have the layer functions you need at present.

This is the JavaScript you can use in an Action Wizard in Acrobat.

Add (More Tools) Execute JavaScript.

It's not ideal but it might help someone else.

The script just reverses the visibility of each layer quoted in the script.

Don't mention a layer in the script and it is left alone.

- If LAYER_A was visible it becomes not visible.

- If LAYER_B was not visible it becomes visible.

- If there was a LAYER_Z , it would stay the same.

I am no Java expert but I think you can removed the "this.flattenLayers()" from the end if you want to keep all your layers.



var docOCGs = this.getOCGs();
for (var x=0; x < docOCGs.length; x++)
{
if(docOCGs[x].name == "LAYER_A")
{
docOCGs[x].state = !docOCGs[x].state;
}
}


var docOCGs = this.getOCGs();
for (var x=0; x < docOCGs.length; x++)
{
if(docOCGs[x].name == "LAYER_B")
{
docOCGs[x].state = !docOCGs[x].state;
}
}


var docOCGs = this.getOCGs();
for (var x=0; x < docOCGs.length; x++)
{
if(docOCGs[x].name == "LAYER_C")
{
docOCGs[x].state = !docOCGs[x].state;
}
}



var docOCGs = this.getOCGs();
for (var x=0; x < docOCGs.length; x++)
{
if(docOCGs[x].name == "LAYER_D")
{
docOCGs[x].state = !docOCGs[x].state;
}
}

this.flattenLayers()



Let me know if you have any questions.
 
Another alternative in Acrobat…

Dupe the original PDF 27 times.

Only make the two required layers visible.

Use the layers panel and select the flatten layers option from the gear icon.

All layers that are not visible will be removed.

Repeat 26 times.



Stephen Marsh
 
Another alternative in Acrobat…

Dupe the original PDF 27 times.

Only make the two required layers visible.

Use the layers panel and select the flatten layers option from the gear icon.

All layers that are not visible will be removed.

Repeat 26 times.



Stephen Marsh

Stephen - we found a solution for this. Pitstop does have a way to select content on a layer.
We told it to look for layer X, then select everything NOT on layer X, then the same with layer Y, threw in a couple of "ands", told it to delete what was left - then delete empty layers (important)
Voila!
 

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top