I am printing different images in my application. problem is printer always print the image in the whole page. if image size is very small printer print in the whole page and it looks very bad. i am using the following code for printing image:-
NSData *dataFromPath = UIImageJPEGRepresentation(croppedImage, 1.0);
if(printController && [UIPrintInteractionController canPrintData:dataFromPath]) {
printController.delegate = self;
UIPrintFormatter *my=[[UIPrintFormatter alloc]init];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"print image";
printInfo.duplex = UIPrintInfoDuplexNone;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.printingItem = dataFromPath;
[printController presentFromRect:_btn_ShareAction.frame inView:_btn_ShareAction.superview animated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %ld", error.domain, (long)error.code);
}
}];
}