Skip to main content
Known Participant
July 17, 2020
Answered

Save as AI and PDF at once (Layers)

  • July 17, 2020
  • 2 replies
  • 1352 views

Hello

 

I want to save Layer 1 (link image) as AI format

and Layer 2 (outline) as PDF format

 

Is there a script for this to save at once?

 

See sample:

 

Layer 1: PDF format (link image only)

 

 

Layer 2: AI format (outline only)

 

 

Thank you

 

 

This topic has been closed for replies.
Correct answer femkeblanco

This should

(1) delete layer 2, save the doc with layer 1 as AI, undo delete,

(2) delete layer 1, save the doc with layer 2 as PDF and undo delete again. 

 

If you want it the other way around, swap the layers' names. 

 

(Replace "..." in the path in line 3 below with your destination.)

 

var layer1 = app.activeDocument.layers["Layer 1"];
var layer2 = app.activeDocument.layers["Layer 2"];
var file1 = new File("/C/Users/.../Desktop/yourFileName");
var PDF = new PDFSaveOptions;
layer2.remove();
app.activeDocument.saveAs(file1);
app.undo();
layer1.remove();
app.activeDocument.saveAs(file1, PDF);
app.undo();

 

 

 

2 replies

pixxxelschubser
Community Expert
Community Expert
October 8, 2020

@elinochinjr wrote: »This is what I need, "Illustratoc CC (Legacy)"«

 

It seems this is:

Compatibility.ILLUSTRATOR17;  // Illustrator CC Legacy

 

If that works for you

have fun

😉

femkeblanco
femkeblancoCorrect answer
Legend
July 17, 2020

This should

(1) delete layer 2, save the doc with layer 1 as AI, undo delete,

(2) delete layer 1, save the doc with layer 2 as PDF and undo delete again. 

 

If you want it the other way around, swap the layers' names. 

 

(Replace "..." in the path in line 3 below with your destination.)

 

var layer1 = app.activeDocument.layers["Layer 1"];
var layer2 = app.activeDocument.layers["Layer 2"];
var file1 = new File("/C/Users/.../Desktop/yourFileName");
var PDF = new PDFSaveOptions;
layer2.remove();
app.activeDocument.saveAs(file1);
app.undo();
layer1.remove();
app.activeDocument.saveAs(file1, PDF);
app.undo();

 

 

 

Known Participant
October 7, 2020

Hello, 

 

sorry to bother you, but I need your help again,

I just don't know how to code,

 

how to make this possible? option when saving AI document,

I need to choose version for my lower version AI

 

Thank you very much!

 

 

femkeblanco
Legend
October 7, 2020

Which lower version of AI do you need?