Copy link to clipboard
Copied
The only way that I've found to place an image via scripting in Illustrator is this:
var doc = app.activeDocument;
var placedItem = doc.placedItems.add();
placedItem.file = new File("image.jpg");
This though is different from the way you would trigger the "File > Place" command in Illustrator (or even InDesign), because you don't get to use the "gun placer" tool and decide where to place the image.
Is there a way to trigger the specific command in IL via JS scripting?
InDesign's has app.activeDocument.place() but I couldn't find anything similar in IL.
Copy link to clipboard
Copied
Could you use the shortcut command for placing something instead (command + D on mac or control + D on windows)?
Copy link to clipboard
Copied
I think it's CMD + P on my Illustrator 2020 installation.
Nethertheless, I have a specific use case (I'm developing a CEP extension) and I wanted to replicate the Place command like it is in the UI.
Copy link to clipboard
Copied
no we don't have a way to trigger the place "gun". The place() function places the image in the middle of the screen, so would need to either move your screen so the image places in the right place or (the easiest) just move your image to the right place using left/top properties or position property
Find more inspiration, events, and resources on the new Adobe Community
Explore Now