[poppler] Getting a raster image like pdf2ppm

Albert Astals Cid aacid at kde.org
Thu May 21 12:48:15 PDT 2009


A Dijous, 21 de maig de 2009, Angus March va escriure:
> Albert Astals Cid wrote:
> > A Dimecres, 20 de maig de 2009, Angus March va escriure:
> >> 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
> >
> > Yeah, i wonder why Jeff said that, poppler has always been ok running in
> > a thread afair.
> >
> >>> ?
> >>>
> >>> 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.
> >
> > How can multiple process create problems if processes are totally
> > separated? Besides i run various pdftoppm in parallel usually and there's
> > no problem.
>
>     At this point I'm keeping a pretty open mind. Anyway, the problem
> wouldn't be one process interfering with another, but perhaps based on
> the process which calls Splash being a different one from the one that
> started the app.
>
> >> It's hard to know where to go.
> >
> > The crashes you pasted are from poppler compiled with -O2? If so remove
> > the - O2 and substitute -g by -g3. Optimized poppler backtraces are
> > really misleading.
>
>     I thought I was using the debug poppler, but I guess not, since the
> poppler functions mentioned in the backtrace don't mention the source
> file names, and are also pointed to the distro poppler.
>     But now I'm having problems rolling my own poppler. I'm using
> 0.10.1, btw, because that's what my distro has. I'm trying to configure
> with "CPPFLAGS="-g3 -O0" ./configure --prefix=/usr/local" but then when
> I go to make I see both "-g3 -O0" and "-g -O2" on the compile lines. How
> do I get rid of the of the optimization options? 

No idea how to do it with autotools, with cmake it's using the -
DCMAKE_BUILD_TYPE=DEBUG option

> Also, the Splash
> headers don't get installed when I call make install. How do I do that?

--enable-xpdf-headers with autotools
-DENABLE_XPDF_HEADERS=ON with cmake

Albert


More information about the poppler mailing list