Jotty – open source app to add annotations to pdf

So few years back, I was working on this iOS app to view and add annotations to pdf files. I have not worked on it for quite some time now and don’t have any specific use as well. Therefore, I have decided to open the source code. Hopefully, someone may find it useful.

This app is implemented in Swift. PDF viewer and annotation functionalities require PDFKit library. PDFKit is a very powerful library but poorly documented. May be because of the newer PencilKit. But in the absence of any good documentation, I had to do a lot of research and own experiments with the code.

PDF Annotate and Viewer iOS app
PDF annotate and viewer iOS app

Implementation challenges

Other than the documentation challenges, the most difficult part of the whole project was implementing the multipage support and undo feature implementation. And I must say that my past experience with Graphics Driver Development for graphics rendering pipeline, surprisingly came handy! For the rendering of the various annotations, PDFKit utilises a Draw function with context-based approach, which is very similar to a 2D or 3D graphics app written in DirectX or OpenGL.

Context based Draw function which does the actual annotation

Another major challenge was the implementation of Undo feature. The app has to keep track of all the annotations added on different PDF pages. There may be still a few bugs, but last I checked it was working smoothly.

As you may notice, on clicking the ‘Purple’ color, UNDO feature gets executed. It was a placeholder functionality, while I was developing the app.

PDF Annotation Undo feature working now

PDF annotate & viewer features implemented in this project:

  • Open a PDF file locally stored or on the cloud.
    • Password protected PDF handling, included.
  • Add various annotations on the opened PDF file:
    • Select, highlight, strikethrough, underline the text.
    • Coloured annotations supported.
    • Blending of colours supported.
  • An animated side toolbar with option to choose:
    • Pen thickness style i.e. like a pen or thick crayon.
    • Choose different colour pallet.
    • Undo functionality.

Source Code:

The code is available at –

Word of caution:

Do keep in mind though, that since I have not worked on it for about an year now, you may require a few minor code updates according to the latest iOS version. And in case you rectify any such change, then I would urge you to send a pull request to keep the code updated for others.

Hope you find this post helpful.

Take care!

Share the post, if you liked it

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.