Skip to main content
Inspiring
September 24, 2024
Question

Can a Illustrator plugin save data to a Illustrator file?

  • September 24, 2024
  • 3 replies
  • 383 views

Is it possible to create a plugin which can set some non-Illustrator original content, which means the data is not supported by Illustrator itself? 

For example, the plugin may attach an attachment into one document. The attachment is stored in the document, whenever the document is open, the plugin can load the attachment.

I have experience of plugin development for InDesign, which has this ability. But InDesign has its own file format (indd) which can save data, just want to confirm whether Illustrator has the same ability.

This topic has been closed for replies.

3 replies

Inspiring
September 25, 2024

If you are working with C++, you can read and store the XMP-Data of the file. 

Reading is:

 

 

AIAPI AIErr (*GetDocumentXAP)(const char **xap);

 

 

 

Writing is:

 

 

 
AIAPI AIErr (*SetDocumentXAP)(const char *xap);

 

 

Both are in AIDocument.h

 

For reading and writing the Metadata correctly, I'm using the XMP-Toolkit from Adobe:

https://github.com/adobe/XMP-Toolkit-SDK

But maybe also other XMP-Tools will work.

BTW: You can see the XMP-Metadata in  "File" -> "File Info" -> "Raw Data"

 

I think with this you can also store binary data as an XMP-Element.

 

I do not know whether it is possible to store it in other places of the document, but please be aware that an AI-Document is more or less a pdf (you can open it in Acrobat when changing the exension fro *.ai to *.pdf) so I do not know what will happen with the compatiblity when storing data somewhere. With XMP it is encapsulated

m1b
Community Expert
Community Expert
September 25, 2024

Just letting you know that Illustrator does not have the "insertLabel" API that Indesign has, so you would need another approach. If you are comfortable with, say C++, look into the Illustrator SDK, which is likely to provide the access you need, as @A. Patterson mentioned. Another idea is to store your data in XMP, which you can do via the normal scripting API and therefore via CEP extensions.

- Mark

A. Patterson
Inspiring
September 25, 2024

I believe so. You can save binary data to dictionary entries in art or the document itself. I don't know what the upper limit is, but it maybe possible to store any amount of binary data -- that would effectively let you store whatever you want in an AI document.