UIPrintInteractionController返回UIPrintUnknownImageFormatError

时间:2012-06-09 06:38:28

标签: iphone ios ipad pdf printing

我正在尝试打印通过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打开。它可能有什么问题?

1 个答案:

答案 0 :(得分:0)

这个技巧有所帮助:

    [receivedData writeToFile:filePath atomically:YES];
    NSData *PDFData = [NSData dataWithContentsOfFile:filePath];