PDF Viewing Support (poppler-qt4)
Gunnar Sletta
gunnar at trolltech.com
Thu Feb 14 09:09:55 CET 2008
Adam Batkin wrote:
> I'm looking to be able to view PDFs in a Jambi app that I'm working
> on. So I thought I'd try porting poppler
> (http://poppler.freedesktop.org/) to Jambi!
Hi Adam,
Cool stuff!
> First I tried playing with the Jambi Generator. I ran in to a bit of
> trouble there (mostly the complexity/lack of documentation, and the
> fact that all of the bits I needed to use were in the Poppler
> namespace, and the generator docs claim it doesn't handle namespaces
> except for enums).
The Qt 4.4 Jambi version of the will have extended support for
namespaces. We've implemented quite a bit there in order to properly
support the Phonon API's so that part should not be an issue in the future.
As for the complexity of the generator... Did you start with the
generator example and try to go incrementally from there? Mapping an API
is not a trivial task, but if there are concrete missing parts of the
docs we would like to hear a bit more about them.
For instance, if the resulting API is just one class that displays a pdf
file, you could write a non-namespace wrapper class which subclasses
QWidget and has a "setPDFFile(const QString &file)" function and map
this using the generator.
> So I went the hand-coded JNI route. Everything seems to be working up
> to the point where I have a native C++ QImage, and I want to stuff
> that into a Jambi (Java) QImage, and I have no idea where to go from
> here.
If you're not using the generator you can still "steal" some of the
logic in it ;-). We have quite a bit of utility functionality that is
used from the generated code in qtjambi_core.h and friends. If you have
a look at the generated code of for instance QPixmap::toImage() you see
that converting a QImage into a proper jobject of class
com.trolltech.qt.gui.QImage is done something like this:
jobject jimg =
qtjambi_from_object(env,
&image,
"QImage",
"com/trolltech/qt/gui/",
true);
I hope this helps a little bit.
best regards,
Gunnar
More information about the Qt-jambi-interest
mailing list