Skip to main content
Doug Habben
Known Participant
August 17, 2015
Question

sAIDictionary->MoveEntryToArt & DeleteEntry do not delete entries from dictionary

  • August 17, 2015
  • 1 reply
  • 500 views

I am working on a plug-in for Mac CS6 and CC that swaps art objects into and out of the document dictionary. I am finding that MoveEntryToArt and DeleteEntry are not removing the dictionary entries and so the document size continues to increase with the added but not removed entries. Any insights appreciated.

This topic has been closed for replies.

1 reply

Inspiring
August 27, 2015

Are you releasing all your dictionary references?

Doug Habben
Known Participant
August 27, 2015

Yes

Inspiring
August 27, 2015

I just tried the following code

  AIDictionaryRef dict = NULL;

  err = sAIDocument->GetDictionary(&dict);

  AIDictKey key = sAIDictionary->Key("My key");

  err = sAIDictionary->SetIntegerEntry(dict,key,99);

  AIDictKey otherkey = sAIDictionary->Key("My other key");

  err = sAIDictionary->SetIntegerEntry(dict,otherkey,33);

  AIDictKey extrakey = sAIDictionary->Key("My extra key");

  err = sAIDictionary->SetIntegerEntry(dict,extrakey,77);

  sAIDictionary->DeleteEntry(dict,otherkey);

  err = sAIDictionary->Release(dict);

I then saved the document as an uncompressed AI file (turn off Use Compression in Illustrator Options when saving). In the ai file, I can find "My key" and "My extra key", but not "My other key" so the delete seems to work for me.