Hello
I’m working on a Photoshop CS2/CS3 plugin. I need to set the ICC profile when
printing. I have code that does this, it works fine when I catch the eventOpen
event:
sPSActionControl->AddNotify(this->GetPluginRef(), eventOpen, _EventOpen,
this);
Here is the code that I use in my eventOpen handler: (I’ve removed all error
checking just to make it shorter for this email.)
error = sPSActionDescriptor->Make(&desc0xe0);
error = sPSActionReference->Make(&ref0x30);
error = sPSActionControl->StringIDToTypeID("printOptions",
&runtimePropID);
error = sPSActionReference->PutProperty(ref0x30, classProperty,
runtimePropID);
error = sPSActionReference->PutEnumerated(ref0x30, classDocument,
typeOrdinal, enumTarget);
error = sPSActionDescriptor->PutReference(desc0xe0, keyNull, ref0x30);
error = sPSActionDescriptor->Make(&desc0xe8);
error = sPSActionDescriptor->Make(&desc0xf0);
error = sPSActionDescriptor->PutObject(desc0xe8, keyPageSetup,
classPageSetup, desc0xf0);
error = sPSActionDescriptor->Make(&desc0xf8);
spaceID = enumCMYKColor;
error = sPSActionDescriptor->PutEnumerated(desc0xf8, keyColorSpace,
typeColorSpace, spaceID);
error = sPSActionDescriptor->PutString(desc0xf8, keyName,
_printProfile);
error = sPSActionDescriptor->PutEnumerated(desc0xf8, keyIntent,
typeIntent, enumImage);
error = sPSActionDescriptor->PutBoolean(desc0xf8, keyMapBlack, true);
error = sPSActionDescriptor->PutObject(desc0xe8, keyPrintSettings,
'PMps', desc0xf8);
error = sPSActionControl->StringIDToTypeID("printOptions",
&runtimeObjID);
error = sPSActionDescriptor->PutObject(desc0xe0, keyTo, runtimeObjID,
desc0xe8);
error = sPSActionControl->Play(&result, eventSet, desc0xe0,
plugInDialogDontDisplay);
There are two problems with my code, one of which is pretty serious. When I
print and change the printer profile from the Print dialog, the profile selected
in the dialog is used, not the one that I select in code. (Lets not debate if
this is a good idea or not...).
So I also catch eventPrint:
sPSActionControl->AddNotify(this->GetPluginRef(), eventPrint, _EventPrint,
this);
And I call the exact same code in my eventPrint handler. The problem is that the
ICC profile I specified in the plugin isn’t being used. Instead, the ICC profile
specified in the dialog is being used. I’m guessing that my code is run and THEN
the dialog is scraped for data. This is clearly a show stopper for the desired
behavior.
The other problem is an odd one. When my code is run the resolution of the image
is set to 72 dpi. I guess I can read the resolution and set it in this code to
the original resolution but that seems odd, I’d rather prevent it from being set
in the first place.
Thanks for looking at this and for any advice you can give.
|