UIPrintInteractionController

UIPrintInteractionController

我正在尝试打印通过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/

10-11 02:16