我使用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'? –