Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF viewing/annotating library for iPhone?

I am currently working on an educational project where I would like to add some PDF reading functionality to an iPhone app. I know that it is possible to add a UIWebView and display the PDF there, however I would like to add the ability to show page number, 'next', 'previous' buttons etc. Is CGPDFDocument the direction that I should be headed or is there a better (ie more feature rich) library available? I have had a look around to try and find the capabilities of CGPDFDocument, but besides the API reference there is not much available.

Would it also be possible with this to annotate a pdf?

Thanks

JP

like image 652
Jack Avatar asked Jan 29 '10 10:01

Jack


2 Answers

Here is a good (working) example of the CGPDF functions: http://www.olivetoast.com/blog/2009/08/simple-uiscrollview-catiledlayer-pdf-example/

It uses a CATiledLayer + UIScrollView, this may not be appropriate for a reader of sorts, but it still shows you how to load and draw a PDF doc without UIWebView (which severely restricts your abilities).

Change the layer type back to a layer, add in page handling using CGPDFDocumentGetNumberOfPages and then CGPDFDocumentGetPage and you have a pretty good reader.

I don't know how to perform annotations, I suspect you would need your own data structure on top of the document.

like image 101
Mobs Avatar answered Oct 08 '22 00:10

Mobs


Update: 04 Feb 2012

Check out this project, it's opensource and very well made. I think it could be a great starting point for your PDF reader.

Project:
http://www.vfr.org/

Source:
https://github.com/vfr/Reader

like image 1
Cesar Avatar answered Oct 08 '22 01:10

Cesar