Skip to main content
Participant
November 2, 2022
Answered

SDK 2023 problem: getting current document

  • November 2, 2022
  • 1 reply
  • 612 views

Hey!

 

I have just migrated from sdk 2022 v4 to sdk 2023 v1 while developing a plugin for Illustrator. I have encountered an issue that some functions that worked well in sdk 2022 do not work in 2023. Mostly they are related to getting the current document and information about it (count the number of layers, getting current document handle, activating a document by index, exporting the document to pdf). Documentation did not seem to change, the solution compiles correctly, other functions related to layers and documents seem to work (like getting a document or layer by index - not activating them though).

e.g. :

sAIDocumentList->Activate(documentHandle, true);  // error DOC?
sAILayer->CountLayers(&count);  // count returns 0 whichever the document is
sAIDocument->WriteDocumentWithOptions(f, kAIPDFFileFormat, kFileFormatWrite, d, false, params);  // error DOC?

sAILayer->GetNthLayer(i, &layerHandle);  // works correctly
sAIDocumentList->GetNthDocument(&documentHandle, ind);  // works correctly

Has anyone else encountered a similar issue? How can it be solved?

This topic has been closed for replies.
Correct answer Manan Joshi

Hi @Stanislava257515460ocg,

I have not tested the api's(unfortunately my dev env is not setup so far). However, I have some suggestions, these API's seem to something that would be in use widely. So the first thing I would do is pick a sample plugin shipped with SDK that call's these API's and then check the behaviour. I suspect there is something unique to your situation else we had a good chance of widespread reports for these failures.

Let us know it goes.

-Manan

1 reply

Manan JoshiCommunity ExpertCorrect answer
Community Expert
November 2, 2022

Hi @Stanislava257515460ocg,

I have not tested the api's(unfortunately my dev env is not setup so far). However, I have some suggestions, these API's seem to something that would be in use widely. So the first thing I would do is pick a sample plugin shipped with SDK that call's these API's and then check the behaviour. I suspect there is something unique to your situation else we had a good chance of widespread reports for these failures.

Let us know it goes.

-Manan

-Manan
Participant
November 2, 2022

Hey!

Thanks for the reply!

Actually just understood that it was my mistake, did not set the reference correctly. and with the previous sdk it was probably using the old builds, that's why it was working 😕😕 But everything works great now, thanks!