[poppler] Getting a raster image like pdf2ppm
Angus March
angus at uducat.com
Wed May 20 06:28:56 PDT 2009
Albert Astals Cid wrote:
> 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.
>
If so, then this is out-of-date:
http://lists.freedesktop.org/archives/poppler/2007-November/003083.html
>> 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());
>
Because I had previously had doc allocated on the stack as a PDFDoc.
When I moved the instance to the heap and made its pointer a member of
the class I decided to put that there, rather than change all the
references to "doc". If you don't like that, you'd probably hate a lot
of my code.
> ?
>
> I don't see anything obviously wrong.
>
> Basically it is:
> * Create PDFDoc
> * Create SplashOutputDev
> * Call SplashOutputDev::startDoc
> * Call PDFDoc::displayPageSlice
>
Well there definitely is something wrong, because it works with
pdftoppm. I thought of things like the __attribute__((constructor))
attribute, or static objects, but I don't see any evidence of the
attribute and I wouldn't know how to find a static object in all that
code. Maybe multiple processes causes problems for Splash. It's hard to
know where to go.
More information about the poppler
mailing list