I am currently working on a Paint Application for iPhones and iPads. I want to print the current screen (Drawing) screen. Can someone help me in this case?
Here is the code I've used so far,
-(void)printImage { NSString *path = [[NSBundle mainBundle] pathForResource:@"micky" ofType:@"png"]; NSData *dataFromPath = [NSData dataWithContentsOfFile:path]; UIPrintInteractionController *pCon = [UIPrintInteractionController sharedPrintController]; if(pCon && [UIPrintInteractionController canPrintData:dataFromPath]) { pCon.delegate = self; UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.jobName = [path lastPathComponent]; printInfo.duplex = UIPrintInfoDuplexLongEdge; pCon.printInfo = printInfo; pCon.showsPageRange = YES; pCon.printingItem = dataFromPath; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) { if (!completed && error) { NSLog(@"Unsuccessfull %@ error%u", error.domain, error.code); } }; [pCon presentAnimated:YES completionHandler:completionHandler]; } }
Again, all I want to know is that I should be able to print the current window (image, screen) instead of the Micky.png image (as in the code)
source share