Re: Windowless printing ?
Re: Windowless printing ?
- Subject: Re: Windowless printing ?
- From: Robert Cerny <email@hidden>
- Date: Mon, 7 Jun 2004 16:08:30 +0200
Well,
you can simply create the view off screen and make a print operation:
NSPrintInfo *sharedPrintInfo = [NSPrintInfo sharedPrintInfo];
NSPrintInfo *printInfo;
NSMutableDictionary *printInfoDict = [NSMutableDictionary
dictionaryWithDictionary:[sharedPrintInfo dictionary]];
NSPrintOperation *op;
NSRect bounds;
NSSize papSize;
float lrMargin, tbMargin;
printInfo = [[NSPrintInfo alloc] initWithDictionary:printInfoDict];
bounds = [printInfo imageablePageBounds];
papSize = [printInfo paperSize];
lrMargin = (bounds.size.width - papSize.width)/2;
tbMargin = (bounds.size.height - papSize.height)/2;
[printInfo setLeftMargin:lrMargin];
[printInfo setTopMargin:tbMargin];
[printInfo setRightMargin:lrMargin];
[printInfo setBottomMargin:tbMargin];
[imageView setFrameSize:NSMakeSize(bounds.size.width,
bounds.size.height)];
[imageView setImage:pdfImage];
[imageView setImageScaling:NSScaleProportionally];
op = [NSPrintOperation printOperationWithView:imageView
printInfo:printInfo];
[op setShowPanels:NO];
[op runOperation];
HTH
Robert
On 7.6.2004, at 15:33, Bob Miller wrote:
Hello,
Does anyone know if it's possible to print a document without
displaying the document's window or bringing up the print dialog ?
Basically a 'direct printing' method ? I have a document application
which does not always require user interaction when printing of a
document's contents. Any info would be greatly appreciated.
Thanks in advance,'
Regards,
Bob Miller.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.