Copy link to clipboard
Copied
Is there a way to access the import options on a placed item?
if you place an ai file with multiple artboards you are allowed to choose which "page" is placed, but when using the javascript it defaults to the first page. Is there a way to access that? I have looked through the javascript guide, but havent found anything.
// place a specific Artboard from an ai doc
var idoc = app.activeDocument;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageToOpen = 4; // it works for Artboards since placing an ai file places the pdf version
var iplaced = idoc.placedItems.add();
iplaced.file = File( '/c/...full path.../your file.ai');
Copy link to clipboard
Copied
Is there a way to access the import options on a placed item?
if you place an ai file with multiple artboards you are allowed to choose which "page" is placed, but when using the javascript it defaults to the first page. Is there a way to access that? I have looked through the javascript guide, but havent found anything.
// place a specific Artboard from an ai doc
var idoc = app.activeDocument;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageToOpen = 4; // it works for Artboards since placing an ai file places the pdf version
var iplaced = idoc.placedItems.add();
iplaced.file = File( '/c/...full path.../your file.ai');
Copy link to clipboard
Copied
My understanding is that artboards are not container objects; i.e. artboards do not contain items (e.g. placedItems). But you can position an item "on" an artboard; you just position the item in relation to the artboard in question.
var yourFile = new File(path);
var yourPic = app.activeDocument.placedItems.add();
yourPic.file = yourFile;
var AB = app.activeDocument.artboards[index];
// var AB = app.activeDocument.artboards.getByName(name);
yourPic.position = [AB.artboardRect[0], AB.artboardRect[1]];
Edit: It seems I misunderstood the question.
Copy link to clipboard
Copied
// place a specific Artboard from an ai doc
var idoc = app.activeDocument;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageToOpen = 4; // it works for Artboards since placing an ai file places the pdf version
var iplaced = idoc.placedItems.add();
iplaced.file = File( '/c/...full path.../your file.ai');