Re: NSPrintOperation Fails to Auto-Paginate?
Re: NSPrintOperation Fails to Auto-Paginate?
- Subject: Re: NSPrintOperation Fails to Auto-Paginate?
- From: David Duncan <email@hidden>
- Date: Mon, 3 May 2010 09:03:32 -0700
On May 2, 2010, at 7:57 PM, DairyKnight wrote:
> I've been working on a tool to print an NSView to a PDF file. I followed
> Apple's documentation but couldn't get the auto-pagination work.
> The resulting PDF file is always long and one-page. Hope someone with
> relevant experience could help me. My code is as follows:
PDFOperationWithView doesn't do pagination. Instead you need to set the job disposition to generate a file rather than to output to a printer. Something like this:
NSDictionary *printInfoDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
NSPrintSaveJob, NSPrintJobDisposition,
urlToSave, NSPrintJobSavingURL, // use NSPrintSavePath on 10.5 or below.
[NSNumber numberWithBOOL:hideExtension], NSPrintJobSavingFileNameExtensionHidden, // only on 10.6 or above.
nil];
NSPrintInfo *printInfo = [[[NSPrintInfo alloc] initWithDictionary:printInfoDictionary] autorelease];
NSPrintOperation *operation = [NSPrintOperation printOperationWithView:view printInfo:printInfo];
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden