objective c - how to open powerpoint by pspdfkit? -
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 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 empty content using above code : (
the pspdfprocessor feature experimental. please try if ppt file works if open safari, uses apple's libraries , can fail files. code here looks it's copied examples in pspdfcatalog , fine.
Comments
Post a Comment