Print Layers to PDF Printer: Smaller filesize than using Export to PDF. This script always leaves Layer 1(top most layer) as visibile and prints each layer seperatly. The filename sent to the PDF printer is the document name dash(-) then layer name. Ex: mydocument-pg1.pdf, mydocument-pg2.pdf
Fairly simple script, based off another script by a different author found at http://www.metaphorical.net/note/on/layer_export
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
var doc = app.activeDocument;
// prepare layers by turning all visibility off
for(var i=0; i
doc.layers[i].visible = false;
}
doc.layers[0].visible = true; //show top most layer for all printing
// go through each layers
var i = 0; //think this should be global so printPDF can access it
for(i=1; i
//checks if greater than 1 to keep top layer always visibile
if (i>1) doc.layers[i-1].visible = false;
printPDF();
}
function printPDF()
{
//Taken from ADOBE ILLUSTRATOR CS5 SCRIPTING REFERENCE: JAVASCRIPT
var printJobOptions= new PrintJobOptions();
var options = new PrintOptions();
options.jobOptions = printJobOptions;
//builds filename for PDF printer of the doc.name with no file exention then a - then layer name
printJobOptions.name = doc.name.substr(0, doc.name.lastIndexOf('.'))+"-"+doc.layers[i].name;
doc.print(options); //prints to default printer
}