[poppler] Poppler in android via JNI

Albert Astals Cid aacid at kde.org
Fri Nov 13 10:15:34 PST 2009


A Divendres, 13 de novembre de 2009, Arthur Peters va escriure:
> So I want to use my android phone as an ebook reader and all the PDF
>  viewers for the platform seem to suck badly. So I want to port poppler and
>  write a simple front end for it.
> 
> I have seen that this has been thought about ("Java/JNI-based frontend for
> Android" in TODO) however I see no technical discussion. I want to start
> such a discussion so that I can get some guidance from people who know
> poppler better. The questions I can think of now are:
> 
> * Should I just render the PDF down to a bitmap in C and then pass that to
> Java and draw it to the screen (basically just modify the ImageOutputDev)?
> Or should I try to use the android native drawing functions to draw the
> lines and glyphs and stuff? (or even use GLES from C)

Doing a Java/AndroidOutputDev is probably better but much more difficult than 
just using the output of SplashOutputDev or CairoOutputDev (provided you have 
the dependencies for those in Android)

> * Does rendering start from scratch every call to displayPageSlice (or
> similar) or is some data cached? I'm wondering because I was thinking about
> only rendering what was needed for the screen at any given time and then
> rendering new parts as needed for zooming and paning.

Rendering starts from scratch, but as far as i remember it is clipped to the 
area you render so it's not rendering all the page each time.

> * What sort of API design should be used? Should it be something as simple
> as:
> 
> class PDFRenderer {
>    public PDFRenderer(File file);
>    /// The returned byte[] contains RGB(A?) values for each pixel.
>    public byte[] renderSection(byte[] image, int page, double hDPI, double
> vDPI, int rotate, int sliceX, int sliceY, int sliceW, int sliceH);
>    public void close();
> }

You could try to mimic the glib or qt APIs, the Qt docu is online at 
http://people.freedesktop.org/~aacid/docs/qt4/ the glib one is in the tarball.

> 
> * Has anyone started work on this already?
Not that i know

> * Are you interested in patches adding this feature to the main repository?
If you volunteer to maintain it and it's of enough quality, of course.

Albert

> 
> Thanks a lot.
> -Arthur
> 



More information about the poppler mailing list