Printing image represented by multiple tiles using Cocoa
Printing image represented by multiple tiles using Cocoa
- Subject: Printing image represented by multiple tiles using Cocoa
- From: Rahul Kesharwani <email@hidden>
- Date: Sun, 23 Oct 2011 16:56:54 +0530
- Acceptlanguage: en-US
- Thread-topic: Printing image represented by multiple tiles using Cocoa
Hi
I have a application that prints a image of a page of document on paper. The image is usually tiled and is provided as a set of 4 tiles representing the entire image. Till now this is being done using Carbon printing APIs . The set of functions calls and their order for printing a document is :
1. PMSessionBeginCGDocumentNoDialog(); //Called at he beginning of a document
2. Following calls at the beginning of each page
PMSessionBeginPageNoDialog();
//Get the current graphics context for drawing the page
PMSessionGetCGGraphicsContex(printSession , &mPrintContext);
//Some Calculations based on paper rect and imageable area
// move the origin of CG from that of paper device to imageable area based on above calculation
CGContextTranslateCTM();
3. While there are more tiles
//Copy image tile(img) to target area(tileRect) on the print device.
CGContextDrawImage(mPrintContext, tileRect, img);
4. PMSessionEndPageNoDialog(); //At end of each page
5. Repeat steps 2-4 for other pages.
6. PMSessionEndDocumentNoDialog() //Called at the end of document
I need to implement the above steps using Cocoa APIs. Any suggestions how to implement this entire workflow using Cocoa. I have my NSPrintInfo instance set up. I know I have to create an instance of NSPrintOperation and initialize it with a NSView representing the page I want to print. I am stuck at step 3, i.e drawing 4 tiles of the image to create a single image representing a page and then create a NSView out of it.
So my problem statement is: How to combine multiple image tiles (each being a CGImageRef) into a single image representing a page and print it using NSPrintOperation. Once this is achieved, how to print multiple such pages of a document using NSPrintOperation?
Thanks & Regards
Rahul Kesharwani_______________________________________________
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