[poppler] (1) blurred text (2) ownership of TextBoxes
Mark Summerfield
mark at qtrac.eu
Tue Oct 21 01:30:17 PDT 2008
Hi,
I recently started using the poppler library with the Qt4 headers and
have found it easy to use and generally excellent.
For example, see http://www.qtrac.eu/diffpdf.html
(1)
I'm now trying to develop a console app that will do 2-up, 4-up, and so
on printing, optionally ignoring each page's margins to maximize the use
of space.
But unfortunately, I'm getting blurred pages and don't know why.
I create a QPrinter in PDF mode and switch render hints _on_ for the
poppler document which I render to a QImage. I then create a QPainter on
the printer and switch its render hints _off_---so that it will just
paint the QImage pixel for pixel.
I've attached (the very rough first cut) of the source (since it is only
160 lines), in case anyone has the time/inclination to have a look, esp.
since I'm hoping I just did something silly that you'll spot in a
moment:-)
[Another problem with the program is that poppler seems to default to 72
dpi, but QPrinter depends on the actual printer driver, so in my case is
75 dpi.]
(2)
In the docs it makes clear that you get ownership of Poppler::Document
and Poppler::Page and so must delete them---that's fine, I use
std::tr1::shared_ptr to handle that. But when you do
Poppler::Page::textList() it isn't clear whether you get ownership of
the Poppler::TextBoxes or not? I've assumed that you don't, but I'd like
to know.
Thanks!
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Programming in Python 3" - ISBN 0137129297
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 5530 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20081021/906c7019/attachment.cpp
-------------- next part --------------
# TODO QtCore only
SOURCES += main.cpp
LIBS += -lpoppler-qt4
INCLUDEPATH += /usr/include/poppler/qt4
More information about the poppler
mailing list