I want to create a dynamic PNG/JPG file programmatically for AI extension.
For photoshop i'm using this approach:
Created a PSD as a template, parse it and created duplicate of it in JSX, then replace the content of all the layers and merge/convert it to JPG and PNG.
var dupeDoc = templateDoc.duplicate(filePath.match(/[^\/]+$/));
But this code is not working in AI. It throws error while duplicating the psd. //templateDoc.duplicate() is not a function
Is it possible to maintain same code base for PS and AI
Or is there any other approach in AI to create PNG/JPG and place text and color rectangle on x,y axis of document (HTML5 Canvas style)
duplicate is not a method of the Document object. To duplicate, you'll have to simply open the file and then do a save-as.