我使用AirPrint打印出UIImage
,但边距不正确。这是它打印时的样子:
使用AirPrint打印UIImage会导致截断内容
有没有一种方法可以使它完全适合纸张?
下面的代码的要求:
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
//pic.delegate = del;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = [NSString stringWithFormat:@"New Ticket"];
pic.printInfo = printInfo;
pic.printingItem = [UIImage imageWithContentsOfFile:path];
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error."
message:[NSString stringWithFormat:@"An error occured while printing: %@", error]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[av show];
[av release];
}
};
[pic presentAnimated:YES completionHandler:completionHandler];
您可能需要向我们显示您的代码。用代码更新了 –
。 – 0xSina
如果您正在打印'UIImage',为什么不将'printInfo.outputType'设置为'UIPrintInfoOutputPhoto'而不是'UIPrintInfoOutputGeneral'? –