質問

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
役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top