A Dimarts 21 Octubre 2008, Mark Summerfield va escriure: > 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.]
The problem with printing images that contain text is usually low resolution of the image, you should be able of fixing this asking for a huge image (setting a high xres and yres on renderToImage) that should give you acceptable printouts at cost of high memory usage. For example, the PS renderer when finds a image with transparency, that is not supported by PS, renders a image and puts it in the PS, the used DPI is 300, and some people still complain is too small. > > (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. You assumed wrong, you need to take care of deleing the textboxes. I'll fix the documentation to clearly state that. Albert > > Thanks! _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
