开发者

Open particular page of PDF

开发者 https://www.devze.com 2023-02-26 09:33 出处:网络
In my application I open a PDF using a web view, and also create a thumbnail of that PDF. I want to open a particular page of my PDF by clicking the thumbnail.

In my application I open a PDF using a web view, and also create a thumbnail of that PDF. I want to open a particular page of my PDF by clicking the thumbnail.

For example,开发者_如何学C suppose my PDF contains seven pages; then I create seven thumbnails and also open the entire PDF in the web view. If I click the first thumbnail, then in the web view the PDF will be open to the start page, and if I click the fifth thumbnail, then the web view displays the fifth page, and also moves up and down.

So please give me sample code to do that -- I am new to iPhone programming, and I am suffering from one serious problem. Please help me.

Thanks.


You should read the Apple documentation about Drawing with quartz 2d. There's a section just about handling with PDF documents. If you don't like to show a PDF in a UIWebView, you create your own view. Just subclass UIView and overwrite the method -(void)drawRect:(CGRect)rect for your custom drawing. Create a CGContextRef a draw your PDF directly in that context using the specific function of core graphics. Core Graphics provides a lot of other functions for PDF documents, like Kalle already mentioned.

If you're not really used to core graphics, it's really difficult sometimes and you probably need a lot time to get used to it, so I recommend using UIWebView to display a PDF. It relatively simple.

0

精彩评论

暂无评论...
验证码 换一张
取 消