Android port of pdf2htmlEX
- Providing easy to use interface for downstream users.
Library is consumed through gradle and used through a Java class, which provides a method to perform conversion. - Keeping device requirements low.
Current versions of NDK support building for Android-16 (Jelly Bean) and newer.
Supported ABIs: armeabi-v7a, arm64-v8a, x86, x86_64. - Keeping installed footprint low.
Sample application consumes under 30MB.
android-sample-app/app/build.gradle contains code to load the library as a dependency in Gradle.
dependencies {
implementation 'com.viliussutkus89:pdf2htmlex-android:0.18.10'
}
pdf2htmlEX-Android is distributed using JCenter Maven repository.
It needs be added to top level build.gradle
allprojects {
repositories {
jcenter()
}
}
Library is interfaced through Java.
import com.viliussutkus89.android.pdf2htmlex.pdf2htmlEX;
...
java.io.File inputPdf = new java.io.File(getFilesDir(), "my.pdf");
java.io.File outputHTML = new pdf2htmlEX(getApplicationContext()).setInputPDF(inputPdf).convert();
Encrypted PDF documents need a password to be decrypted.
Either owner (admin):
java.io.File outputHTML = new pdf2htmlEX(getApplicationContext()).setInputPDF(inputPdf).setOwnerPassword("owner-password").convert();
or user password can be used:
java.io.File outputHTML = new pdf2htmlEX(getApplicationContext()).setInputPDF(inputPdf).setUserPassword("user-password").convert();
Library needs Android Context to obtain path to cache directory and asset files, which are supplied in .aar.
pdf2htmlEX depends on 4 libraries:
- Cairo
- FontForge
- FreeType
- Poppler
These libraries also have dependencies of their own. FontForge requires FreeType, libjpeg, zlib, et cetera. Full list of packages and patches to build them is included in packages folder.
DependencyBuilder is a meta project which builds it's ExternalProjects (Cairo, FontForge, et cetera). Current implementation supports building projects which are based on Autotools, CMake and Meson.
pdf2htmlEX-Android consumes previously built libraries and provides a Java wrapper to call pdf2htmlEX.
Example demonstrates how to convert PDF files to HTML and either open the result in browser or save to storage. Storage Access Framework (SAF) is used for file management, it requires API level 19 (KitKat). Debug build of sample application is available in Releases Page
- Meson Build system
- pkg-config
- CMake-3.10.2
- ndk-21.0.6113669
- gettext
- gperf