我试图从我的UIWebView
打印PDF,但输出PDF没有填写A4格式。为什么?我该如何解决?
非常感谢任何帮助=)
答案 0 :(得分:2)
如果找到解决方案避免打印表单IUWebView
。我直接以 NSData 格式下载 PDF 。
_data表示我通过请求下载的NSData。
if (_data) {
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
//printInfo.jobName = [path lastPathComponent];
printInfo.duplex = UIPrintInfoDuplexLongEdge;
printController.printInfo = printInfo;
printController.showsPageRange = YES;
printController.printingItem = _data;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
if (!completed && error) {
NSLog(@"FAILED! due to error in domain %@ with error code %lu", error.domain, (long)error.code);
}
};
[printController presentAnimated:YES completionHandler:completionHandler];
}