Currently I am working on a Paint Application for iPhones and iPads. I want to print the current screen display (Drawing) of the screen. Can any body help me in these case ?
Here is the code i have 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 what i want to know is i should be able to print the Current Window(Drawing, Screen) instead of the Image Micky.png (as in the code)
This code takes a screenshot of the current view and outputs an
UIImageof it: