Search code examples
iosobjective-cprintingcontentmode

Printing captured screenshot - blurred image


I've got some code to print screenshot. The problem is that instead of 'fit' image, default action is to 'fill' paper with image, what causes stretches. In case of printing screen of iphone (eg non-retina) it is looking awful.

I can't find property or any way to print the image without stretching it, can anyone help with this?

// print
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputPhoto;
printInfo.jobName = [NSString stringWithFormat:@"something")];
pic.printInfo = printInfo;

UIPrintFormatter *printFormatter = [[UIPrintFormatter alloc] init];
[printFormatter setMaximumContentHeight:image.size.height];
[printFormatter setMaximumContentWidth:image.size.width];
pic.printFormatter = printFormatter;

pic.printingItem = image; //low-res image

Solution

  • You have probably to set the contentInsets. Use the UIEdgeInsets UIEdgeInsetsMake ( CGFloat top, CGFloat left, CGFloat bottom, CGFloat right ); Function to set the contentInsets.