Place SVG in Illustrator
Asked Answered
J

1

6

I'm trying to place an svg in illustrator using extendscript. Here's basically what I'm doing

var doc = app.documents.add();
var p = doc.placedItems.add();
p.file = new File(svgfilepath);

This fails with the error

File is in a format that cannot be placed

I am able to place the same file manually using File > Place. Am I missing some thing? Need help!

Jory answered 3/3, 2015 at 18:21 Comment(2)
Illustrator's Javascript team still has much to learn... Does this same syntax work with other 'placeable' items such as JPEGs or PDFs?Wholewheat
Yes! Jpegs/Pngs are placed fine with this.Jory
J
10

By W_J_T on forums.adobe.com:

var doc = app.activeDocument;  
var svgFile = File(Folder.desktop + '/testSVG.svg');  
doc.groupItems.createFromFile(svgFile);  

This works!

Jory answered 4/3, 2015 at 10:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.