0
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];
        });
    });

i open a empty content using above code : (

Raptor
  • 53,206
  • 45
  • 230
  • 366
  • PSPDF KIT is a demo version. How can you integrate that ?? You cannot use the DEMO version in your applications when submitting to the APPLE STORE. – Manu May 20 '13 at 04:49
  • i just testing how to use PSPDFKIT to open doc,xls,ppt and if it is appropriate for my project , i will buy it :). – user2400455 May 20 '13 at 04:59
  • Did you get this working properly? Did you try conversion of another ppt document? – Krešimir Prcela Jan 20 '14 at 11:17

1 Answers1

2

The PSPDFProcessor feature is experimental. Please try if the PPT file works if you open it with Safari, it uses mostly Apple's libraries and they can fail for certain files. The code here looks like it's simply copied from my examples in PSPDFCatalog and is thus fine.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
steipete
  • 7,581
  • 5
  • 47
  • 81