Skip to main content
Inspiring
February 4, 2010
Answered

Document Raster Effects Settings... again...

  • February 4, 2010
  • 1 reply
  • 5605 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 querying/setting these values.  I'm using the CS3 SDK on Mac OS X 10.6.2

So, as the subject states, I'm after the values in the "Document Raster Effects Settings..." dialog, located in the "Effects" menu.  Specifically, the "Resolution".  I believe it was suggested in the previous threads about this to look at the "outputResolution" field of the AIDocumentSetup struct.  The CS3 SDK states that this field is "Not Used" and the field itself always seems to be set to 800.0 for me.

I noticed that these values were local to the document itself and that modifying them causes the documents dirty flag to be set. So I thought maybe they're stored in the document's dictionary.  So I dumped out the key strings from the document's dictionary and found "AI9 Output Rasterization Resolution" which (after having to guess the data type) always seems to be 300.

I don't know where else to look.  These values have to be stored somewhere as they are stored with the document.  I can view them easily as part of the document object via an Applescript dictionary explorer, but I refuse to believe that Applescript has access to a value that I don't via a plugin.

If anyone can help me shed any light on this I'd really appreciate it!

-W

This topic has been closed for replies.
Correct answer A. Patterson

Setting the Document Raster Effects is actionable, so you could always use that as a means. I recorded an action that set the settings to the following:

Model: CMYK

Resolution: 300 dpi

Background: Transparent

Anti-alias: No

Create Clipping Mask: No

Padding: 36 pt

The action looks like this:

/version 2
/name [ 5
    5365742031
]
/isOpen 1
/actionCount 1
/action-1 {
    /name [ 8
        416374696f6e2033
    ]
    /keyIndex 0
    /colorIndex 0
    /isOpen 1
    /eventCount 1
    /event-1 {
        /internalName (ai_plugin_rasterEffectSettings)
        /localizedName [ 32
            446f63756d656e742052617374657220456666656374732053657474696e6773
        ]
        /isOpen 1
        /isOn 1
        /hasDialog 1
        /showDialog 0
        /parameterCount 6
        /parameter-1 {
            /key 1668246642
            /showInPalette -1
            /type (enumerated)
            /name [ 4
                434d594b
            ]
            /value 5
        }
        /parameter-2 {
            /key 1685088558
            /showInPalette -1
            /type (integer)
            /value 300
        }
        /parameter-3 {
            /key 1651205988
            /showInPalette -1
            /type (enumerated)
            /name [ 11
                5472616e73706172656e74
            ]
            /value 1
        }
        /parameter-4 {
            /key 1634494835
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-5 {
            /key 1835103083
            /showInPalette -1
            /type (boolean)
            /value 0
        }
        /parameter-6 {
            /key 1885430884
            /showInPalette -1
            /type (unit real)
            /value 36.0
            /unit 592476268
        }
    }
}

Its pretty obvious which parameters are which, so one should be able to use AIActionSuite::PlayAction at worst to change the document raster settings.


Nevermind, I found the dictionary entries. The document's dictionary has an entry called 'AI Auto Rasterize'. That is itself a dictionary, which contains the following entries:

'padd', real entry (Padding)

'mask' boolean entry (Create Mask)

'spot' boolean entry (Preserve Spot Colours)

'alis' boolean entry (Anti-Alias)

'dpi.' integer entry (DPI, yes, that is a period at the end)

'colr' integer entry (combination of Colour Model & background colour)

That last one will take a little bit of investigation. I think there must be an enum for it somewhere in the headers, but when I changed CMYK (with transparent background) to Greyscale (with transparent background) I believe it changed from 5 to 4. When I tried CMYK (with white background) it went to 1. So those two settings are obvious tied up together, but at worst we can just map them out once and be done with it.

1 reply

A. Patterson
Inspiring
February 4, 2010

Man, a lot of people seem to want to do this and apparently we have never found a solution I wish someone from Adobe would chime in here, I'm afraid I'm tapped out for ideas. Unless its actionable, in which case you could probably use AIActionSuite::PlayAction to do an end run on setting it. That said, feels kind of dumb that its so hard to modify document setup when there's an obvious struct.

Inspiring
February 5, 2010

It is getting kinda frustrating.  I've now resorted to listening for a various notifications for clues as to what's going on when that "Ok" button is clicked in the dialog.  So far I'm catching a preferences-changed notification but I haven't yet determined what (if anything) is being sent with it, guess I'll keep looking.

My only goal here is reading the current "Resolution" value, I have no need to modify it.  I'm hoping this much is possible and of course, if I get anywhere, I'll post the details here of course

-W

Inspiring
February 5, 2010

Ok, seems like I made a few hasty assumptions.

The Illustrator preferences are changed when something changes in the Doc Raster Effects Settings dialog.  This dialog seems to be implemented by an external plugin and upon the user clicking "OK", the default values are changed and stored in the preferences, hence the notification.  After looking at the preferences file before and after an alteration to the values, the defaults for this dialog are stored in:

/plugin

{

     ...

     /Rasterize {
             /Defaults {
                 /Padding 36.0
                 /Mask 0
                 /Spot 1
                 /Alias 0
                 /DPI 300
                 /Type 5
             }
             /rasterizeMemory 20

     }

     ...

}

However these are just the default values, presumably the values applied to all new documents.  These settings are also stored at the document level, as closing the document and opening it elsewhere shows the same values.  I'm still convinced that the dictionaries are the right place to look, although needle in haystack springs to mind.

-W