简体   繁体   中英

Converting PPT or PPTX to PDF in iOS objective-c (xcode)

I just want to convert PPT or PPTX files into PDF files in iOS objective-c application. (iPhone and iPad apps)

But I couldn't find any straightforward solution to do this.

Is there any method to convert powerpoint files to PDF files?

No other options needed, just want to convert it. (Not through generating images, because of resolution problem)

Thank you!

There is a way to do it in several steps.

Firstly, you should load your pptx file into UIWebView.

// fileURL – URL of your pptx file
NSURLRequest* request = [NSURLRequest requestWithURL:fileURL];
webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
webView.delegate = self;
[webView loadRequest:request];

When your webView did finish load your get content of your webView:

NSString *htmlContent = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];

Then you can render your html content as PDF without quality loose. There is a tutorial where is described how to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM