【问题标题】:UIPrintInteractionController returns UIPrintUnknownImageFormatErrorUIPrintInteractionController 返回 UIPrintUnknownImageFormatError
【发布时间】:2012-06-13 02:40:21
【问题描述】:

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

【问题讨论】:

    标签: iphone ios ipad pdf printing


    【解决方案1】:

    这个技巧有帮助:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多