Mailing Lists: Apple Mailing Lists

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

Getting a list of printer names, not queue names



I have some code to get the list of printers and then get the name of the current printer. The code looks something like this:
OSStatus status;
PMPrintSession thePrintSession;
CFArrayRef printerList;
CFIndex currentIndex;
PMPrinter currentPrinter;
CFStringRef nameRef;
uchar theName[256];


status = PMCreateSession(&thePrintSession);
if (status == kPMNoError) {
printerList = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, NULL);
if (printerList) {
status = PMSessionCreatePrinterList(thePrintSession, &printerList, &currentIndex, &currentPrinter);
if (status == kPMNoError) {
nameRef = (const CFStringRef)CFArrayGetValueAtIndex(printerList, 1);
CFStringGetPascalString(nameRef, (uchar *)theName, 256, kCFStringEncodingMacRoman);
CFRelease(nameRef);
}
CFRelease(printerList);
}
PMRelease(thePrintSession);
}


This seems to work. I have one question though. Let's say I create a printer with the same name as an already existing printer. The two printer names are identical but the queue names are different, the new name has a '-1' added to the end of it to make it unique. When I get a list of printer names using the above routine it actually returns a list of queue names, not printer names. But when I go into the print dialog and click on the Printer popup I see a list of printer names, not queue names. I would like to create a list of printers that matches the names in the Printer popup. How would I go about doing this?

Thank you,

Alex Kettner

_______________________________________________
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.