Skip to main content
Inspiring
November 9, 2024
Question

How to save illustrator document properly in C++ plugin

  • November 9, 2024
  • 1 reply
  • 262 views

I'm learning the AI C++ SDK and trying to create a plugin. The plugin mainly funciton is :

1. open document using "SnpDocumentHelper::OpenDocument"

2. make some changes with find and replace like "SnpText::FindAndReplace"
3. Save document with "SnpDocumentHelper::SaveDocument"

4. close documetn with "SnpDocumentHelper::CloseDocument"

5. repeat 1-5

 

Currect situation is that if we only do step 1 and step 2, everything is expected, those documents were opened and find replace worked as well, then if I close those opened documents, it will ask for save.

 

The problem is that, if we add step3 and step4, the document change won't be saved. Even just added step3 without step4, the changes are also disappeared.
We have no idea why it hebavies like this. Mabe the change status was notified later than saving document in code?

So, the question is how to save a changed document using C++ API properly? 

 

This topic has been closed for replies.

1 reply

Eric DWKJAuthor
Inspiring
November 9, 2024

A bit more about "The problem is that, if we add step3 and step4, the document change won't be saved. Even just added step3 without step4, the changes are also disappeared.", it didn't crash, if adding step3&4, the documents will be closed successfully, with no content change. If only add step3, the documents keep open but no changes at all.