Printing multiple images each on a separate page using single NSPrintOperation
Printing multiple images each on a separate page using single NSPrintOperation
- Subject: Printing multiple images each on a separate page using single NSPrintOperation
- From: Rahul Kesharwani <email@hidden>
- Date: Sun, 30 Oct 2011 19:44:11 +0530
- Acceptlanguage: en-US
- Thread-topic: Printing multiple images each on a separate page using single NSPrintOperation
Hi
I have a application that intends to print raster image of each page of a document using NSPrintOperation. I am able to create a NSImage of a single page and print it using NSPrintOperation as follows
-void printPage: (NSImage)nsImage
{
NSImageView *nsImageView = [[NSImageView alloc] init];
NSSize imageSize = [nsImage size];
[nsImageView setImage: (NSImage *)nsImage];
[nsImageView setFrame:NSMakeRect(0, 0, imageSize.width, imageSize.height)];
[nsImageView setImageScaling:NSScaleToFit];
NSPrintOperation *mNSPrintOperation = [NSPrintOperation printOperationWithView: (NSView *)nsImageView];
NSPrintInfo *currentNSPrintInfo = [NSPrintInfo sharedPrintInfo];
[currentNSPrintInfo setHorizontalPagination:NSFitPagination];
[currentNSPrintInfo setVerticalPagination:NSFitPagination];
[mNSPrintOperation setPrintInfo:currentNSPrintInfo];
[mNSPrintOperation setShowsPrintPanel:NO];
[mNSPrintOperation setShowsProgressPanel:YES];
[mNSPrintOperation runOperation];
}
Now when I have multiple pages to print, I would like to print all of them using a single NSPrintOperation. So basically, I would like to insert NSImage/NSImageView of each page as a separate page into a single NSView and use this NSView to print finally using NSPrintOperation. The reason I want to print it using single NSPrintOperation is that I want to get the print progress bar that shows the current page being printed. Otherwise, I could have created a separate NSPrintOperation for each NSImageView and print using it.
Any help would be greatly appreciated
Thanks & Regards
Rahul
_______________________________________________
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