5

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!

Yawar
  • 335
  • 1
  • 9

1 Answers1

9

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!

Yawar
  • 335
  • 1
  • 9