| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hi,_______________________________________________
I'm working on a PDE customized Mac printer driver and in a PDE I want to
read the values of the installable options. I used some code Joris Kempen
got from Paul Danbold but that still does provide me the correct answer.
Here is what I did:
In the PPD file I defined the installable option OCMailBoxOption as follows:
*OpenGroup: InstallableOptions/Options Installed
*OpenUI *OCMailBoxOption/Mailbox : PickOne
*DefaultOCMailBoxOption: False
*OCMailBoxOption True/Use mailbox: ""
*OCMailBoxOption False/Don't use mailbox: ""
*CloseUI: *OCMailBoxOption
*CloseUI: *OCPageProgrammerOption
When I build and run the driver I can select it in Print Center and change
the value using the Show Info pane.
So far so good.
When I actually print I find some PS code in the output that correctly shows
the value:
%%BeginFeature: *OCMailBoxOption False
Of course I could parse the printjob to get the value, but that won't solve
the problem that I need the value also in the PDE!
Here are some code-snippets of my PDE code:
// PPD keys to look for in OCMailboxPDE
const unsigned char* kOCMailboxOptionKey = "\pOCMailBoxOption";
const unsigned char* kOCMailboxOptionValueKey = "\pOCMailBoxOption";
// Name: Prologue
// ... nothing of any interest here
// Name: Initialize
OSStatus Initialize( PMPDEContext context, PMPDEFlags* flags, PMPDERef ref,
ControlRef parentUserPane, PMPrintSession printSession)
{
OSStatus err = noErr;
myPluginContextPtr myContext = (myPluginContextPtr) context;
if ((myContext != NULL) && (printSession != NULL))
{
PMTicketRef printerInfo = NULL;
// Get the PrinterInfo TicketRef from the Session.
err = GetTicketFromSession(printSession, kPDE_PMPrinterInfoRef,
(void *)&printerInfo);
// Open the PPD, if available, and check it for the OCCoversPDE key
if (err == noErr)
{
FSSpec tempFSSpec;
PPDContext ppdContext;
Mindex mIndex;
Oindex oIndex;
err = ppdOpenCompiledPPDFromTicket(printerInfo, &ppdContext,
&tempFSSpec);
if(err == noErr)
{
mIndex = ppdGetMainIndex(ppdContext, (const
StringPtr)kOCCoversPDEKey);
// no valid key found
if(mIndex == kPPDInvalidIndex)
{
err = kPMInvalidKey;
}
else
{
// !!! check installable options !!!
err = setInstallableOptions(ppdContext, printerInfo);
if (err == noErr)
{
mIndex = ppdGetMainIndex(ppdContext, (const
StringPtr)kOCMailboxOptionKey);
if(mIndex)
{
oIndex = ppdGetOptionIndex(ppdContext, (const
StringPtr)kOCMailboxOptionValueKey);
VERBOSE("OCPDEpaper: Mailbox option: %d %d\n",
mIndex, oIndex);
if (oIndex)
{
// check value of option
// err = 1;
}
}
}
// end snippets
When I run the driver the statement
VERBOSE("OCPDEpaper: Mailbox option: %d %d\n", mIndex, oIndex);
always shows in the PB debugging console:
OCPDEpaper: Mailbox option: 44 0
independent if the mailbox option is true or false.
What am I doing wrong?
Shouldn't I use the ticket services mechanism? in the ticket services info I
find:
#define kPMInstallableOptionStr kPMPrinterInfoPrelude "PMInstallableOption"
#define kPMInstallableOptionKey CFSTR(kPMInstallableOptionStr)
But how do I use them?
Hans Loonen
_______________________________________________
printing mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/printing
Do not post admin requests to the list. They will be ignored.
| References: | |
| >getting the value of installable options in a PDE (From: "Hans Loonen" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.