ralfstuckert / pdfbox-layout

MIT License
155 stars 74 forks source link

Is there a way to add support for Android? #95

Open AndroidDeveloperLB opened 1 year ago

AndroidDeveloperLB commented 1 year ago

When I tried to use the sample of hyperlinks (here), I got this error:

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/color/ColorSpace;
 at org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.init(PDDeviceRGB.java:64)
 at org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGB(PDDeviceRGB.java:103)
 at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:85)
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.color.ColorSpace" on path:

And this occurs by just creating a new instance of "PDDocument".

Android almost doesn't have anything related to AWT, so it can't use a lot of it.

Anything related to UI is used on its own classes of Android. Is there a way to have a generic alternative here for each feature that uses AWT?

For example, for colors, is there a way to just provide ARGB values? And for image, is there a way to just provide an array (1d or 2d) of ARGB values, with width&height?

Attached sample here. My Application.zip

AndroidDeveloperLB commented 1 year ago

I've seen that some people wrote about this, but maybe things have changed? Can AWT usage be completely avoided?