Copy link to clipboard
Copied
What is the correct way to import one ai file into another?
I'm using
#target illustrator
var pi = lay.placedItems.add();
pi.file = new File( Folder.desktop + '/test.ai' );
But this solution destroy groups of imported file and moreover if an object has fill and stroke then they will be detached into different objects.
The imported file is linked and the whole content placed into clipping mask ant it is not handy.
Is there a way to copy the content of imported file rather than import it to preserve groups and objects appearence?
1 Correct answer
Bonjour,
une approche parmi d'autres.
...// JavaScript Document for Illustrator
// import_ai.js de elleere Tue, 1 May 2018 10:54:47 GMT
var docRef = activeDocument;
var fsName = "sample.ai";
var fileSpec = new File("~/"+fsName);
var placed = app.open(fileSpec);
for (var i = 0; i < placed.pageItems.length; i++ ) {
placed.pageItems.selected = true;
}
docSelected = selection;
docRef.activat;
if (docSelected) {
layer = docRef.layers.add();
layer.name = fsName;
for ( i = 0; i < docSe
Explore related tutorials & articles
Copy link to clipboard
Copied
Bonjour,
une approche parmi d'autres.
// JavaScript Document for Illustrator
// import_ai.js de elleere Tue, 1 May 2018 10:54:47 GMT
var docRef = activeDocument;
var fsName = "sample.ai";
var fileSpec = new File("~/"+fsName);
var placed = app.open(fileSpec);
for (var i = 0; i < placed.pageItems.length; i++ ) {
placed.pageItems.selected = true;
}
docSelected = selection;
docRef.activat;
if (docSelected) {
layer = docRef.layers.add();
layer.name = fsName;
for ( i = 0; i < docSelected.length; i++ ) {
docSelected.selected = false;
newItem = docSelected.duplicate(layer);
}
}
placed.close(SaveOptions.DONOTSAVECHANGES);

