UPDATE (Nov 2017): This article has been updated to include Foxit MobilePDF SDK, a feature-rich mobile PDF SDK solution with extensive support for advanced PDF features. For more details, see my latest post.
Being able to preview as well as editing PDF documents is a very common requirement in many Android or iOS applications such as eBook readers or PDF form filling utilities. This article shares various PDF libraries which I have experimented, for the benefits of those who are developing PDF utilities for iOS, Android as well as other platforms.
Handling PDF using built-in libraries
To preview PDF documents on iOS, you can just use UIWebView. Much like the default browser, UIWebView supports many common file types such as PDF, Microsoft Office and multimedia documents (refer to this article for the full list). Just feed the PDF link (which can be either local or remote) to a UIWebView and your PDF will be rendered nicely:
Displaying PDF in a UIWebView, however, has some issues. The default page navigation (vertical scroll) will become inconvenient if the PDF has too many pages. It also does not offer search or bookmarking capabilities, and most importantly, does not render PDF form fields or annotations well.
The iOS SDK also comes with some Quartz 2D methods that can do basic parsing of PDF documents (via the CGPDFDocument object) and retrieves basic properties by converting it into NSDictionary objects. Any advanced manipulation would require the use of a dedicated PDF SDK.
On Android, PDF creation is only natively supported starting from Android 4.4 (API level 19) via the android.graphics.pdf package while PDF rendering is only supported since API level 21. On earlier versions, you’ll need to use one of the PDF libraries described in the next few sections instead. The default WebView component only renders web pages and does not support PDF, office or multimedia documents, unlike iOS.
Radaee PDF SDK
Formerly known as PDFViewer SDK, Radaee PDF is a paid PDF rendering/editing engine that supports both Android and iOS, as well as Windows 8/RT and Windows Phone.
It has three different versions, standard, professional and premium and costs as low as $489 for a single application license. The standard edition offers PDF viewing functionalities, the professional edition provide annotation capabilities and the premium edition offers PDF form editing features as well as encryption support. For most people who just need some improvements over basic PDF features offered by UIWebView, the Standard edition, which supports displaying of PDF annotations and form fields, should suffice. A trial version is available for users to test out the SDK.
The Radaee PDF sample apps on both Google Play and iTunes demonstrate some of the SDK capabilities. This is the home screen of the Android demo app:
PDF_ANNOT Page_getAnnot(PDF_PAGE page, int index)
bool Page_addAnnotInk2(PDF_PAGE page, PDF_INK hand)
bool Page_setAnnotEditText(PDF_PAGE page, PDF_ANNOT annot, const char *text)
int Page_getAnnotFieldName(PDF_PAGE page, PDF_ANNOT annot, char *buf, int buf_size)
With these methods and some knowledge of PDF file format, one should be able to manipulate PDF forms programmatically with no issues.
Made by PDFTron, this is a multi-platform PDF engine that supports iOS, Android, Windows Phone and Xamarin. A desktop versions for .NET, Java, C/C++ and Pythons are available too. The company also offers a HTML to PDF conversion library and a WebViewer that supports previewing of a wide variety of file formats.
The sample iOS and Android applications of PDFTron, which come with the SDK, support PDF annotations such as highlighting, drawing shapes, writing text and the like:
The SDK also supports for rendering and filling PDF forms. The SDK API methods also provide ways to extract data from PDF forms as well as editing the PDF files, both on Android (in Java) and iOS (in Objective-C).
Same as Radaee PDF, PDFNet is not free, which is understandable. However what I do not like about this SDK is that the website does not specify a fixed price for the SDK and request users to ask for quotation. This causes the final price to be open to interpretation and may vary wildly depending on other seemingly unrelated factors. There is also no trial version immediately available for download from the website.
Foxit Mobile PDF SDK
This SDK is made by Foxit, the company that creates Foxit Reader, often used as an alternative to Adobe PDF Reader. It supports iOS, Android and Universal Windows Platform (UWP). This is a screenshot of the Foxit SDK sample Android application:
The SDK also supports UWP, allowing you to develop PDF-enabled applications for Windows 8 and Windows 10:
Foxit does not provide direct download links to the SDK on its website, only a trial request form which you have to fill in to contact a sales representative for the links. The download comes with library files, documentation and sample apps for all supported platforms.
During my tests this SDK clearly stands out as being feature-rich, stable and providing support for a wide range of PDF features. For more details, see my latest post.
This is a nice PDF engine for both iOS and Android. It supports both PDF form filling and annotations. There is a trial version available for download on its website, although users would need to contact sales to ask for a quotation in order to purchase.
This library supports both Android and iOS and costs 699 USD for a single app license. It seems to support annotations – however, no form editing support is mentioned on the website.
A 30-day trial version is available for download.
Debenu Quick PDF Library
This is a multi-platform PDF library that seems to support PDF creation, rendering and editing. PDF form filling and annotations are also supported. The SDK comes with example applications that can run on Windows, Mac and iOS.
A single developer license is $499 and a trial version is available for download from its website.
Adobe Reader Mobile SDK
This SDK, provided by Adobe, supports Mac OS, Win32, iOS and Android and allows user to preview PDF and other popular ebook format such as EPUB nicely on their devices. Although it seems like an interesting library, its website provides no downloads or additional information on the SDK, except for an email address to contact the sales department.
Adobe also provides a desktop-only library, Adobe PDF Library SDK with extensive PDF integration capabilities.
PDF libraries that support only iOS
A few PDF libraries that only support iOS, but not other platforms are listed below for your reference:
This is an alternative to PSPDFKit and comes in 4 different versions: Free, Basic, Plus and Extra. The Free edition comes with all the capabilities but will show a predefined splash screen in every application that uses the SDK. The Basic version, available at 990 EUR, only offers basic viewing support. The Plus version (1990 EUR) provides text search and extraction capabilities but no multimedia support. For all the available features, you would need to purchase the Extra version at 2990 EUR.
FastPDFKit does not seem to support forms or annotations. The prices are therefore a bit too high for a basic PDF viewer library that can only search and extract text from PDF files.
This SDK comes in 3 edition, Single App ($1999), Developer ($6999) and Enterprise ($9999). The Single App license can only be used on a single application whereas the others can be used to build multiple applications and include the source code. The Enterprise license does not required license key activation.
PDFTouch can only render annotations but does not support PDF form filling.
This free PDF library support previewing of PDF forms and provides some simple methods for form fields data extraction. Annotations are not supported, however.
PDF libraries that support only Android
Below are some Android-only PDF libraries:
Supporting only Android, this SDK supports PDF rendering as well as form filling and data extraction. It also supports creating PDF, exporting pages to images, editing document properties, document encryption and other advanced features.
A trial version which will embed a watermark on the PDF documents can be downloaded from its website. To purchase, users would need to ask for a quotation.
This SDK supports creating, previewing and editing PDF documents with advanced features like form filling, annotations and adding text/graphics elements. The cheapest license, Standard Developer Small Business, is $799 and a trial version is available for download from the website.
This SDK supports Android, .NET and Java and allows creating of PDF forms, form filling as well as annotation.
Interestingly, iTextCore provides an Affero General Public License (AGPL) license which allows you to use the library for free as long as you disclose the source code of your application. For closed-source projects, you will need to contact them to ask for a quotation.
The latest library source code of iTextCore can be found on GitHub.
Other open-source PDF libraries
The following are some open-source PDF engines that can be ported to various platforms including mobile devices, but do not officially have specific iOS or Android support:
This is an open source PDF rendering engine that supports viewing, printing and filling PDF forms. The code is part of Chrome PDF Engine, written by Foxit, the same company that developed the Foxit PDF Embedded SDK, and forms part of the Google Chrome PDF plugin.
More information can be found on this blog post. Whether part of this code is used in the commercial PDF SDKs by Foxit, or whether it can be compiled to target mobile platforms, remains to be seen as nobody has attempted yet.
PoDoFo is a free portable C++ library which includes classes to parse a PDF file and modify its contents into memory. It also includes very simple classes to create PDF files.
An iOS port is available on GitHub.
This is a tiny open source library written in C/C++ which allows creating of simply PDF files of text and graphics. It cannot read PDF files or create files with forms or annotations.
This is an example of a PDF document created by libHaru:
The verdict: which one is the best?
Having personally explored in depth PDFNet SDK, Foxit MobilePDF SDK and Radaee PDF SDK while experimenting with other libraries in an effort to find out the most suitable library for my previous projects, I would say Foxit MobilePDF is currently the best mobile PDF SDK solution in the market due to its extensive PDF support. However, if you want something simpler, Radaee PDF and PDFNet SDKs with support for common PDF features such as annotations or form filling would still come in handy
Other free alternatives like libHaru and ILPDFKit may also be useful for projects which do not require full PDF capabilities and only have very specific needs for certain functionalities, such as PDF creation or form field extraction. If your project targets Android and is open-source, iTextCore would make an excellent choice.
One final comment I would like to make is regarding the license cost of these PDF libraries. Most companies either ask for very high prices or require a quotation from their sales staff. Very few offer clear affordable prices targeting single developers or small companies who just want to develop a few apps that make use of PDF-specific features. Why? I guess it could be partially due to the lack of native PDF support on mobile platforms that results in more development efforts and higher SDK costs. There could possibly be more reasons, which I will leave as an exercise for the readers to find out.