-
Notifications
You must be signed in to change notification settings - Fork 581
Android support
OpenPDF never supported Android.
But for some versions of Android it may be possible to use OpenPDF anyway.
OpenPDF relies heavily on AWT (java.awt
) and Android SDK lacks these packages. So to try to make OpenPDF work with Android you need to use some library that make java.awt
and javax.imageio
available to Android.
One of such libraries is android-awt.
This feature is experimental! If you find any AWT related bug while using OpenPDF on your Android application, please file a new issue here.
In order to use OpenPDF library on Android, please import the android-awt library alongside OpenPDF. This libray provides java.awt.*
and javax.imageio.*
packages and classes.
Note: This works only with some versions of android. Since Android API level 27 'Harmony' was deprecated and android-awt
may not work anymore.
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation 'com.github.librepdf:openpdf:1.3.8'
implementation 'com.github.andob:android-awt:1.0.0'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.andob</groupId>
<artifactId>android-awt</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.librepdf</groupId>
<artifactId>openpdf</artifactId>
<version>1.3.24</version>
</dependency>