我正在尝试打印通过NSURLConnection下载的pdf文档
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
NSData *PDFData = urlConnection.receivedData;
if (pic && [UIPrintInteractionController canPrintData:PDFData] ) {
pic.printingItem = PDFData;
...
[pic presentAnimated:YES completionHandler:completionHandler];
}
我在completionHandler中收到UIPrintUnknownImageFormatError,尽管pdf很好并且由任何pdf-viewer打开。它可能有什么问题?
答案 0 :(得分:0)
[receivedData writeToFile:filePath atomically:YES];
NSData *PDFData = [NSData dataWithContentsOfFile:filePath];