Question

I'm using MuPDF to open and edit PDFs in my android application, but I need of some way to get the current page in a bitmap format.

I've been reading the code, but I've not succeed. Someone can help me?

Was it helpful?

Solution

We have a similar feature in our Android customizable magazine app, using muPDF: we generate page thumbnails in bitmap format. This app is open source and available on Github. You can see there how we implemented this feature.

OTHER TIPS

The MuPDF API is a C level one. It's certainly capable of doing what you want - see apps/mudraw.c for code that does this, or even doc/render.c.

In the example android viewer, we needed to be able to do some things from java. So, we wrapped up a small fraction of the API with jni and exposed that (see android/jni/mupdf.c). This does just enough for what we need, and nothing more.

If you want to get access to parts of the API that aren't exposed, (and it sounds to me like you do) then you'll have to wrap up that for yourself.

In an ideal world, we'd have it set up so that there was a direct mapping from java classes down to the underlying MuPDF API, but we haven't had the time/need to do that yet. If anyone out there is interested in doing such a thing, do get in touch...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top