Re: simple printing question
Re: simple printing question
- Subject: Re: simple printing question
- From: Tom Bernard <email@hidden>
- Date: Tue, 29 Jun 2004 04:36:49 -0600
You will need to do something like
- (void)printReceipt:(Transaction *)transToPrint
{
NSPrintOperation *op;
NSView *view = [[NSTextView alloc]
initWithFrame:NSMakeRect(0.0,0.0,200.0,10.0)]; // replace 200.0 with an
appropriate width
[view insertText:[transToPrint descriptionSummary]];
NSPrintInfo * pi = [NSPrintInfo sharedPrintInfo];
[pi setHorizontallyCentered:NO];
[pi setVerticallyCentered:NO];
[pi setLeftMargin:36.0]; // 36 points
[pi setTopMargin:36.0];
op = [NSPrintOperation printOperationWithView:view printInfo:pi];
[op setShowPanels:NO];
[op runOperation];
[view release]; // don't leak memory
}
There are a lot of things you may control with NSPrintInfo, including paper
size, margins and whether the view is centered vertically and horizontally.
Regards,
Tom Bernard
email@hidden
on 6/28/04 5:32 AM, Andrew Kinnie at email@hidden wrote:
>
However, now it prints, but it is tiny, and leaves large margins on
>
each side (which is bad considering the paper is only 72 mm wide).
_______________________________________________
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.