0
Explorer
,
/t5/illustrator-discussions/javascript-amp-colon-placing-an-item-with-multiple-artboards/td-p/11716352
Dec 30, 2020
Dec 30, 2020
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.
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Community Expert
,
Dec 30, 2020
Dec 30, 2020
// 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');
Explore related tutorials & articles
Guide
,
/t5/illustrator-discussions/javascript-amp-colon-placing-an-item-with-multiple-artboards/m-p/11716539#M257598
Dec 30, 2020
Dec 30, 2020
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/illustrator-discussions/javascript-amp-colon-placing-an-item-with-multiple-artboards/m-p/11717323#M257630
Dec 30, 2020
Dec 30, 2020
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');
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

