printer info
printer info
- Subject: printer info
- From: John Terranova <email@hidden>
- Date: Wed, 10 Nov 2004 19:14:01 -0800
If there is a better list to ask this question, please point me in the right direction.
I'm trying to get information from the printer after the print panel is ok'd and before I start printing, but I can't find a way to get the information out of the NSPrintInfo or the NSPrinter. Here's, basically, what I do:
{
NSPrintInfo *info = [self printInfo];
NSPrintPanel *panel = [NSPrintPanel printPanel];
[panel beginSheetWithPrintInfo:info modalForWindow:[[self windowController] window] delegate:self didEndSelector:@selector(printPanelDidEnd:returnCode:contextInfo:) contextInfo:(void *)info];
}
- (void)printPanelDidEnd:(NSPrintPanel *)printPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode != NSOKButton)
return;
NSPrintInfo *prInfo = (NSPrintInfo *)contextInfo;
// ???
// how can I use prInfo, or [prInfo printer] to figure out if the user chose duplex?
// [[prInfo printer] stringForKey:@"?Duplex" inTable:@"PPD"];
// this seems to return PostScript code to do the duplexing
// but how do I tell if the user chose it in the print dialog?
for ( ; ; )
{
NSPrintOperation *op = [NSPrintOperation printOperationWithView:[self printableView] printInfo:prInfo];
[op setShowPanels:NO];
[op setCanSpawnSeparateThread:YES];
[op runOperationModalForWindow:[[self windowController] window] delegate:self
didRunSelector:@selector(printOperationDidRun:success:contextInfo:)
contextInfo:context];
// other stuff to control the looping, set up the next print operation, etc
}
If the user selected duplexing, I can just print the whole document. But, if the user chose no duplexing, or the printer doesn't support double sided printing, then I need to stop printing occasionally and prompt the user to put the printed paper back in the printer to print the second side. Hence, the multiple print operations.
I can use
[[prInfo printer] stringForKey:@"?Duplex" inTable:@"PPD"] to see if the printer returns nil or not. If not, then which option is currently set and how can I tell?
Any suggestions for how to get this information from the printer? Can I do it with Carbon Printing functions? PMTicket functions? I haven't found a way. Maybe I just don't know the proper key to pass to
PMSessionGetTicketFromSession( PMPrintSession session, CFStringRef key, PMTicketRef* theTicket ).
Thanks.
--
john terranova, email@hidden
It is enough that the people know there was an election.
The people who cast the votes decide nothing.
The people who count the votes decide everything.
-- Joseph Stalin (attributed) _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden