首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用pspdfkit打开powerpoint?

如何用pspdfkit打开powerpoint?
EN

Stack Overflow用户
提问于 2013-05-20 12:42:50
回答 1查看 516关注 0票数 0
代码语言:javascript
复制
NSURL *documentURL = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"item_70_1_3.ppt"];
PSPDFDocument *document = [PSPDFDocument documentWithURL:documentURL];
NSURL *tempURL = PSPDFTempFileURLWithPathExtension(@"flattened_signaturetest", @"pdf");

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
        [[PSPDFProcessor defaultProcessor] generatePDFFromDocument:document pageRange:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, document.pageCount)] outputFileURL:tempURL options:@{kPSPDFProcessorAnnotationTypes : @(PSPDFAnnotationTypeAll)} progressBlock:^(NSUInteger currentPage, NSUInteger numberOfProcessedPages, NSUInteger totalPages) {
            // Access UI only from main thread.
            dispatch_async(dispatch_get_main_queue(), ^{
                [PSPDFProgressHUD showProgress:(numberOfProcessedPages+1)/(float)totalPages status:PSPDFLocalize(@"Preparing...")];
            });
        } error:NULL];

        // completion
        dispatch_async(dispatch_get_main_queue(), ^{
            [PSPDFProgressHUD dismiss];
            PSPDFDocument *flattenedDocument = [PSPDFDocument documentWithURL:tempURL];
            PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:flattenedDocument];
            UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:pdfController];
            [self presentViewController:navController animated:YES completion:NULL];
        });
    });

我使用上面的代码打开一个空内容:(

EN

回答 1

Stack Overflow用户

发布于 2013-05-20 13:23:10

PSPDFProcessor功能是实验性的。如果你用Safari打开PPT文件,请试一试,如果你用Safari打开它,它主要使用苹果的库,它们可能会对某些文件失败。这里的代码看起来像是简单地复制自我在PSPDFCatalog中的示例,因此很好用。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16642735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档