Create a document using the SDK
Hi everyone,
I'm trying to create a document using the SDK. I found the AIDocumentListSuite, which seems to be just what I need, but when I try to create a document, it just returns the error "ENEW". The documentation just says that this means Illustrator failed to create a document, which doesn't tell me why it is not working.
This is my code:
AIDocumentListSuite* AIDocumentList;
ASErr error = message->d.basic->AcquireSuite(kAIDocumentListSuite, kAIDocumentListSuiteVersion, (const void**)&AIDocumentList);
if ((!error) && (AIDocument != nullptr))
{
ai::UnicodeString templ = ai::UnicodeString("A4");
AIDocumentHandle handle;
error = AIDocumentList->New(templ, NULL, kDialogOn, &handle);
if (!error)
{
error = AIDocumentList->Activate(handle, true);
if (error)
{
PopupBox(&message->d, nullptr, "Can't open created document: Open a document before connecting to MSD!");
}
else
{
// Do something with the document...
}
}
else
{
PopupBox(&message->d, nullptr, "Can't create document: Open a document before connecting to MSD!");
}
message->d.basic->ReleaseSuite(kAIDocumentListSuite, kAIDocumentListSuiteVersion);
AIDocument = nullptr;
}Anybody has any idea on what the problem might be? Or where can I look?
Best regards,
Diogo
