Get Updates By E-mail 

Article Written By:
Johann Dowa

Tutorials And Examples: Creating PDFs On iOS Using Quartz, UIKit, And libHaru


I’ve talked about using PDF files mentioned some open source libraries for easily turning PDFs into eBook apps, and a short tutorial on using the QLPreviewController for document previewing.

What I haven’t said much about is creating PDFs – this is mainly because Apple has created some pretty extensive documentation on creating PDFs.

The reason why I’m mentioning different approaches here is because none of them are perfect, and you’ll need to test them out and see which one works best in your app and adjust from there.

Creating PDFs With The iOS SDK Using Quartz

If you do decide that you want to create PDFs using the iOS SDK Tope Abayomi (who is from the App design vault which btw is giving ManiacDev.Com readers two free app themes in this giveaway ending in a few days) has created a very straightforward tutorial on how to do so using Quartz.

If you’re struggling through Apple’s documentation on how to do this I highly suggest checking it out.

You can find the tutorial in two parts: Part 1, Part 2

In theory you can do just about anything with PDFs using Quartz (see Apple’s Quartz PDF documentation), but as you can see from the comment thread on Tope’s tutorial using Quartz for pdf generation  is not without its issues.

Creating PDFs With The iOS SDK Using UIKit

The UIKit provides some libraries for creating PDFs that are somewhat easier to use.  While you don’t get all the low-level functionality available if you want to take your your UI view’s and put them straight into a PDF this is probably the way to go.

You can find an excellent example on taking creating a PDF with UIKit here.

Using libHaru To Generate PDFs

If you’ve researched PDF creation on iOS then you may have noticed the cross platform Libharu library being mentioned.  From what I’ve tried this works very well, and makes another great alternative.

You can find a demo project on using Libharu with iOS here.

A library for searching PDFs on iOS Demonstrating Quartz Parsing

Since manipulation/parsing PDFs go hand in hand with creating them here’s a library created specifically for Objective-C and the iOS platform that you may want to check out.

Some time ago I came across a library from Marcus Hedenström that allows you to search through PDFs known as PDFKitten that you can find on Github here that works very well for searching.

You can look through the code and see those Quartz PDF parsing routines in action.


Creating PDFs and getting everything working right can be difficult and they all seem to have their little quirks.

With the different methods method (Quartz, UIKit, libHaru) here you should be able to get on the right track.


Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.