iFXPDFFactory – the PDF library for iOS and OS X
August 04th, 2012
In July I started working on iFXPDFFactory, a new PDF library for iOS and OS X. It is being developed entirely in Objective-C with a native Objective-C public interface.
The reason I started this library is that there is no native Objective-C library for iOS and Mac OS X. PDFKit for Mac OS X, although has an Objective-C interface, is very limited in features and libHaru, PoDoFo and CGPDF* API are all C/C++ based so no ARC or garbage collection. PDFKit is mainly designed to display PDF files, libHaru can only create PDF files, PoDoFo can create and modify PDF files but it has to be built from source code, not a simple thing for novices, and CGPDF* API is a readonly API for reading PDF files at very low level. The graphic context on iOS/OS X lets you also create PDF files but it is limited to graphic features available in all types of graphic contexts so no standard PDF features such as annotations or form fields.
With iFXPDFFactory I plan to fix several of the problems above. It is designed specifically for iOS/OS X and being written in Objective-C lets you take advantage of ARC or garbage collection on OS X. It will support both PDF creation and editing of existing PDF files. Some of the planned PDF features are: multiple colorspaces, fonts, images, vector graphics, form XObjects, annotations, form fields, encryption, content extraction and many more.
The library is in the early stages of development but the basic PDF creation has been implemented. This is how the API looks like:
// Create a new PDF document with an empty collection of pages. IFXPDFDocument* document = [[IFXPDFDocument alloc] init]; // The 'emptyPage' selector returns an autoreleased page object. IFXPDFPage* page = [IFXPDFPage emptyPage]; // Add the page to the document. [document.pages addPage: page]; // Work with the page here // Save the PDF document as a PDF file and release it. [document writeToFile: pathToPdfFile]; [document release]; |
A more compact version of the code above looks as follows:
// Create a new PDF document with an empty collection of pages. IFXPDFDocument* document = [[IFXPDFDocument alloc] init]; // The 'addEmptyPage' selector creates a page object, // adds it at the end of the pages collection and then returns the autoreleased page object. IFXPDFPage* page = [document.pages addEmptyPage]; // Work with the page here // Save the PDF document as a PDF file and release it. [document writeToFile: pathToPdfFile]; [document release]; |
This is what I have so far. Over the course of next months I'll keep you posted with the development progress. As soon as a feature becomes available I'll write a post about it.
If you have any questions, feedback, criticism about this library feel free to contact me by posting a comment here.
The current build of IFXPDFFactory for iOS can be downloaded here.
August 16th, 2012 - 19:10
When will this be ready? What is the cost? When could I get a beta copy? I need to have pdf in my app that collects user input into form fields and saves the data. Will it support this?
August 16th, 2012 - 22:01
At this moment this is an afterwork effort. I plan to have a beta available during December but the first version will support PDF creation only features. Next updates will bring support for loading PDF files and modifying them including filling form fields. All these operations will be from code only, the library will not include a PDF viewer. If by “I need to have pdf in my app that collects user input into form fields” you mean to display the PDF form to the user and let the user fill the fields then this feature will not be supported.
January 17th, 2013 - 18:28
Thank you for your work on this. This is a great project considering what is out there in the way of PDF developer libraries.
I too am working with a client on how to present form fields to a user and allow them to enter data. If this feature will not be supported in your library then it may not be the answer for us but I am curious in your expert opinion. Is there a technical reason you are not supporting this feature or simply one of the potential features you had to cut out since you can’t support everything?
January 18th, 2013 - 16:37
There is no technical reason, it is simply one of the potential features I had to cut out since I can’t support everything from the beginning. In the first stage this library will be a PDF generator and editor, and by editor I mean load existing PDF files and modify them, split, merge, encrypt, fill forms, etc, all from code, nothing visual. Then depending on how things work out, I’ll look into implementing a PDF viewer.
September 2nd, 2012 - 07:44
Sounds like a great project. One other problem I’d bring up is the prohibitive cost for developers of using some of the existing commercial PDF libraries. For an independent developer cost is important as margins can be quite low with apps because of the low price that can be charged to the end user. In the case of one of my apps, it’s not possible to pay in the region of $1 per app sold in order to add one or two minor PDF features that only a subset of my users need. I don’t know the answer to this, because I know that writing a good PDF library is a big job and the developer needs rewarding appropriately.
September 3rd, 2012 - 16:15
A developer tool, such as a PDF library or other toolkit, has a much smaller audience than an application for casual user. This is why the price difference. The price range I’m considering for this product is US$200 – US$300 but nothing is decided. Based on the feedback received during the development this can change. Also if the market shows that such prices are not feasible I’ll adapt myself.
November 20th, 2012 - 20:03
if need any beta testers let us know
November 21st, 2012 - 08:38
Ok, thank you.