1

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

4

1 回答 1

0

这个技巧有帮助:

    [receivedData writeToFile:filePath atomically:YES];
    NSData *PDFData = [NSData dataWithContentsOfFile:filePath];
于 2012-06-28T20:32:14.337 回答