in my iPhone application i am loading a pdf file on UIWebview. I PDF URL is called from the webserver. My problem is that it is taking a lot of time to display the PDF File. Can any one please suggest me how can i make it bit fast.
开发者_运维技巧Thanks!
Most likely, you cannot eliminate the latency in:
- downloading your pdf from the web
- displaying the pdf in the UIWebView
but you may be able to hide the latency by preparing the data before you need to display it in a background operation. The NSOperationQueue and NSOperation class make doing this relatively straightforward. Load the data in an NSOperation, save it to a temporary file, assign it to display in a "offscreen" UIWebView (one whose frame makes it not display on the screen), and when you finally need to display the pdf, just place the UIWebView into your current view or move it onscreen by changing its frame.
If you have control over the pdf itself, you can use Acrobat to optimize it for downloading and electronic viewing.
In Acrobat 10, use either the PDF Optimizer command, or the Preflight tool (select Online Publishing 'optimize for size')
Webview is very slow in rendering the PDF. Using native CGPDFDocument API will be fast, but you need to handle the complex loading and rendering process.
精彩评论