• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: simple printing question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Need to change screen elements on button clicked in drawer
  • Next by Date: [ANN] iPartition 1.0
  • Previous by thread: Re: simple printing question
  • Next by thread: One for the Unix gurus
  • Index(es):
    • Date
    • Thread