[poppler] Getting a raster image like pdf2ppm

Albert Astals Cid aacid at kde.org
Tue May 19 14:39:16 PDT 2009


A Dimarts, 19 de maig de 2009, Angus March va escriure:
> Adrian Johnson wrote:
> > Angus March wrote:
> >> I tried using Poppler to get a Cairo surface and then saving the surface
> >> to a PNG. Unfortunately, the resulting image was of disastrously low
> >> quality.
> >
> > Without seeing your code or the output you are getting I can only
> > guess at what the problem might be. Did you alter the cairo scale to
> > get the desired image dpi?
>
>     It was definitely an improvement, but I think the only thing that
> did improve was the resolution. The old problems that caused me to
> abandon Cairo persisted, which are: gradients have ugly stripes on them,
> a background that should be white and opaque is black and transparent,
> and some text that has a shadow in the PDF doesn't in the image. I don't
> suppose you know of a way to deal w/those problems.
>
>     But this is my code for the Splash solution I was using, derived
> from the pdftoppm code I found. Again, my problems there are
> segmentation faults, which valgrind reported on. I won't repeat those
> reports, unless someone asks me to. Don't be fooled by the word
> "thread". 

Poppler works perfectly inside threads.

> It's a throwback to when I had an MT solution. This solution,
> as I'm sure you'll figure out, is multi-process. This is the entirety of
> my Poppler and Splash code. Do you see anything that I missed?

C++ courses ;-)

    PDFDoc &doc = *m_pdoc;
    splashOut->startDoc(doc.getXRef());

is one of the weirdest things i've ever came across, why not just

    splashOut->startDoc(m_pdoc->getXRef());

?

I don't see anything obviously wrong.

Basically it is:
 * Create PDFDoc
 * Create SplashOutputDev
 * Call SplashOutputDev::startDoc
 * Call PDFDoc::displayPageSlice

Albert


More information about the poppler mailing list