pdf2htmlEX library port for Android
- Documenter on Google Play - reference application for pdf2htmlEX-Android and wvWare-Android libraries.
- OpenDocument.droid on Google Play - It's Android's first OpenOffice Document Reader!
- Now defunct pdf2htmlEX-Android sample application.
Using prebuilt libraries is less problematic if all the libraries used in the application are:
- Built with the same major version of toolchain - ndk-26
- Linked against shared C++ STL -
android.defaultConfig.externalNativeBuild.cmake.arguments "-DANDROID_STL=c++_shared"
in app's (and all JNI dependencies) build.gradle.
pdf2htmlEX-Android is distributed through MavenCentral. Add a dependency in build.gradle
:
dependencies {
implementation("app.opendocument:pdf2htmlex-android:0.18.26")
}
Library is interfaced through Java.
import app.opendocument.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.