Skip to main content
Known Participant
May 23, 2023
Answered

document raster effect details again

  • May 23, 2023
  • 1 reply
  • 918 views

Hi All,

 

I know this has been asked a couple of times before, but I don't think anyone ever confirmed the correct way of retrieving document raster effect details..  i need to get document raster effect details.

i have tried using dictionaries but didn't got the way to retrieve the details.

if anyone know about retrieving document raster effect details. please kindly help me to get this.

sorry for asking the same question again...
thank you

This topic has been closed for replies.
Correct answer Wayne C.

The Document Raster Effects Settings are stored in the root of the Document Dictionary under the key "AI Auto Rasterize". I have a feeling that the key might not exist if the raster effects settings have not been set - I might be wrong on this though. However it's worth bearing this in mind when you attempt to obtain them and code around that scenario accordingly, i.e. check for a null dictionary reference when you attempt to get the Rasterize dictionary etc.

 

Please note that I've just written this from memory - there's no error checking and there might be typo's etc.

 

#include "IAIRef.h"
...


ai::Ref<AIDictionaryRef> docDict;
ai::Ref<AIDictionaryRef> rastDict;

sAIDocument->GetDictionary(docDict << ai::Replace);
sAIDictionary->GetDictEntry(docDict, sAIDictionary->Key("AI Auto Rasterize"), rastDict << ai::Replace);

AIReal padd;      // Padding around object in points (I think)
AIBoolean spot;   // Preserve Spot Colours True/False
AIBoolean mask;   // Create Clipping Mask True/False
ai::int32 dpi;    // Resolution as an integer
AIBoolean alis;   // Anti-Alias True/False
ai::int32 colr;   // Color Model - This value determines both Color Model and Background. It might be a bit-field but I can't remember right now. Have a play with the values in the dialog and see what you get back 

sAIDictionary->GetRealEntry(rastDict, sAIDictionary->Key("padd"), &padd);
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("spot"), &spot);
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("mask"), &mask);
sAIDictionary->GetIntegerEntry(rastDict, sAIDictionary->Key("dpi."), &dpi;
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("alis"), &alis);
sAIDictionary->GetIntegerEntry(rastDict, sAIDictionary->Key("colr"), &colr);

I hope this helps.

-W

1 reply

Wayne C.Correct answer
Inspiring
May 23, 2023

The Document Raster Effects Settings are stored in the root of the Document Dictionary under the key "AI Auto Rasterize". I have a feeling that the key might not exist if the raster effects settings have not been set - I might be wrong on this though. However it's worth bearing this in mind when you attempt to obtain them and code around that scenario accordingly, i.e. check for a null dictionary reference when you attempt to get the Rasterize dictionary etc.

 

Please note that I've just written this from memory - there's no error checking and there might be typo's etc.

 

#include "IAIRef.h"
...


ai::Ref<AIDictionaryRef> docDict;
ai::Ref<AIDictionaryRef> rastDict;

sAIDocument->GetDictionary(docDict << ai::Replace);
sAIDictionary->GetDictEntry(docDict, sAIDictionary->Key("AI Auto Rasterize"), rastDict << ai::Replace);

AIReal padd;      // Padding around object in points (I think)
AIBoolean spot;   // Preserve Spot Colours True/False
AIBoolean mask;   // Create Clipping Mask True/False
ai::int32 dpi;    // Resolution as an integer
AIBoolean alis;   // Anti-Alias True/False
ai::int32 colr;   // Color Model - This value determines both Color Model and Background. It might be a bit-field but I can't remember right now. Have a play with the values in the dialog and see what you get back 

sAIDictionary->GetRealEntry(rastDict, sAIDictionary->Key("padd"), &padd);
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("spot"), &spot);
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("mask"), &mask);
sAIDictionary->GetIntegerEntry(rastDict, sAIDictionary->Key("dpi."), &dpi;
sAIDictionary->GetBooleanEntry(rastDict, sAIDictionary->Key("alis"), &alis);
sAIDictionary->GetIntegerEntry(rastDict, sAIDictionary->Key("colr"), &colr);

I hope this helps.

-W

Mahesh12Author
Known Participant
May 24, 2023

thank you so much @Wayne C.  the code which you provided it works.  

Inspiring
May 24, 2023

Hi @Mahesh12 

 

Awesome! Glad I could help. Sorry, I forgot about the Counted Object Suite which is required by the ai::Ref class and is not loaded by default - but I see you've already solved that.

ai::Ref is really useful for any reference-counted objects such as AIDictionaryRef, AIEntryRef, AIArrayRef etc. as the class manages the reference counts and cleans up automatically on destruction.