我正在尝试像这样打印通过 NSURLConnection 下载的 pdf 文档
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
NSData *PDFData = urlConnection.receivedData;
if (pic && [UIPrintInteractionController canPrintData:PDFData] ) {
pic.printingItem = PDFData;
...
[pic presentAnimated:YES completionHandler:completionHandler];
}
尽管 pdf 很好并且可以由任何 pdf 查看器打开,但我在 completionHandler 中收到 UIPrintUnknownImageFormatError。它可能有什么问题?
最佳答案
这个技巧有帮助:
[receivedData writeToFile:filePath atomically:YES];
NSData *PDFData = [NSData dataWithContentsOfFile:filePath];
关于iphone - UIPrintInteractionController 返回 UIPrintUnknownImageFormatError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10958983/