Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Layers as PDF?

Status
Not open for further replies.

evolvingvisions

Technical User
Jul 30, 2003
26
US
Is there a script that can export the top-level Layers of an Adobe Illustrator CS3 document as a multi-PAGE PDF?
 
this was the script i used in CS2, but it will not work in CS3. Can anyone help me out.

const mm = 72/25.4;

var doc = app.activeDocument;

var bleedBorder = 5 *mm;
var dialogStr = 'Write PDFpreset name';
var NamePreset = '[Illustrator Default]';

var strColor = new CMYKColor();
var nameLayer = 'effect';
strColor.cyan = 0;
strColor.magenta = 0;
strColor.yellow = 0;
strColor.black = 0;

if (documents.length > 0){
if (str = prompt (dialogStr, NamePreset)) {
NamePreset = str;
var saveOpts = new PDFSaveOptions();
saveOpts.pDFPreset = NamePreset;
h = doc.height;
w = doc.width;
if (doc.saved==false) doc.save();
var mLayer= doc.layers.add();
mLayer.name = nameLayer;
var rect = mLayer.pathItems.rectangle (h + bleedBorder, 0 - bleedBorder, w + bleedBorder*2, h + bleedBorder*2);
rect.fillColor = strColor;
rect.stroked = false;
rect.opacity = 100.0;
mLayer.zOrder(ZOrderMethod.SENDTOBACK);
mLayer.locked = true;
for (i=0; i<doc.layers.length; i++)
if (doc.layers.locked == false) doc.layers.visible = false;
fullDocName = doc.fullName;
var param = doc.name.split('.');
realDocName = param[0];
for (i=0; i<doc.layers.length; i++){
if (i-1<0) doc.layers.visible = true;
else {
doc.layers[i-1].visible = false;
doc.layers.visible = true;
}
if (doc.layers.locked == false) {
docName = '_sb_'+realDocName+doc.layers.name;
var saveName = new File ( doc.path + "/" + docName );
doc.saveAs( saveName, saveOpts );
}
}
doc.close(SaveOptions.DONOTSAVECHANGES);
doc = null;
app.open (fullDocName);
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top