• 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: Windowless printing ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Windowless printing ? (From: Bob Miller <email@hidden>)

  • Prev by Date: GUI without IB
  • Next by Date: Re: Why is "." a decimal number? (NSScanner question)
  • Previous by thread: Windowless printing ?
  • Next by thread: Java or C++ for cross-platform Cocoa/.NET?
  • Index(es):
    • Date
    • Thread