Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to replace deprecated ppd functions?



Hi,

I aksed some questions about this topic before and I got some usable answers
from Michael Sweet but I'm still missing a link.
The problem:
I have developed and built PDE based printer drivers for some time now. When
Tiger came out I installed the Panther (thus PowerPC based) on Tiger systems
and they worked without complains.
Building with Intel based Tiger I see that functions like:
- ppdOpenCompiledPPDFromTicket
- ppdGetMainIndex
- ppdCloseCompiledPPDFromTicket
are reported with the warning deprecated.
I've spent some with the documentation (and the answers I got from Michael
Sweet) and came to the following solution:

This code is present in my PDE's Initilize function:
CFMutableDictionaryRef ppdDict = NULL;
OSStatus result = noErr;
PMTicketRef PrintSettingsTicket;
OSStatus PMTicketCreateResult = PMTicketCreate (kCFAllocatorDefault,
kPMPrintSettingsTicket, &PrintSettingsTicket);
if (PMTicketCreateResult != noErr)
{
    VERBOSE("OCPDEpaper: Initialize: PMTicketCreateResult = %d\n",
PMTicketCreateResult);
}
result = PMTicketGetPPDDict (PrintSettingsTicket, kPMTopLevel, kPMTopLevel,
&ppdDict);
// 1
if (result == noErr)
{
    CFStringRef str = NULL;
    if (CFDictionaryGetValueIfPresent (ppdDict, CFSTR("OCPDEpaper"), (const
void **)&str))
    {
        VERBOSE("OCPDEpaper: Initialize: OCPDEpaper found with
PMTicketGetPPDDict\n");
        if (CFStringCompare (str, CFSTR("Upper"), 0) == kCFCompareEqualTo)
            // 3
        {
            //*bin = UPPER;
        }
        else
        {
            //*bin = LOWER;
        }
    }
    else
    {
        VERBOSE("OCPDEpaper: Initialize: OCPDEpaper NOT found with
PMTicketGetPPDDict\n");
    }
}
else
{
     VERBOSE("OCPDEpaper: Initialize: PMTicketGetPPDDict (printSettings,
kPMTopLevel, kPMTopLevel, &ppdDict) failed result =%d\n", result);
        //*bin = UPPER;
        // 4
}
//return result;

The main part of this code is copied from the document Extending Printing
Dialogs, Custom tasks, Handling PostScript Features.
In this document a function
OSStatus MyGetOutputBin (CFTicketTicketRef printSettings, MyBinType *bin)
is described. What I miss is how a correct
CFTicketTicketRef printSettings is created. The function calling
MyGetOutputBin is responsible for doing that.
In my code sample above I tried doing that with:

PMTicketRef PrintSettingsTicket;
OSStatus PMTicketCreateResult = PMTicketCreate (kCFAllocatorDefault,
kPMPrintSettingsTicket, &PrintSettingsTicket);
.
.
result = PMTicketGetPPDDict (PrintSettingsTicket, kPMTopLevel, kPMTopLevel,
&ppdDict);

I don't get any errors and still my entry "OCPDEpaper" is not found in the
PPD file though Im certain it is there.
What could be wrong?

Furthermore I wonder what happened to PDE strategy as a whole, in the old
could I had to lookup my PDE keyword up in the PPD file during initialize
and if not found I would return "kPMInvalidKey" to notify that the PDE
should not be attached or "noErr" to indicate that the PDE should be
attached. I don't see any of this back in the current documentation.
Who can help?

Regards,

Hans

PS: BTW I guess that this is the same problem as Yu  Min is facing in his
question about "If have universal bunary libcups?"


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Printing mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/printing/email@hidden

This email sent to email@hidden



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.