ImageMagick
ImageMagick copied to clipboard
Rendering pdf with libpoppler
The poppler library (forked from xpdf) has really neat PDF rendering capabilities with better results than ghostscript. It uses cairo+glib so it might be similar to the rsvg
delegate.
The license is GPL 2/3 unfortunately but libpoppler is already in debian/fedora/homebrew so we can link dynamically on most systems.
If no-one else does I might try to find some time to try and implement this later this year.
It doesn't look like the poppler library can export CMYK with or without alpha, a requirement for rendering PDF. Also, does it compile under Windows?
It builds under windows with mingw-w64
for sure (e.g. http://repo.msys2.org/mingw/x86_64/). No idea about MSVC, but probably @dlemstra can get it to work. The dependency stack is very similar to librsvg
.
@urban-warrior the poppler configure script seems to have an option:
--enable-cmyk Include support for CMYK rasterization
@jeroen wrote:
The poppler library (forked from xpdf) has really neat PDF rendering capabilities with better results than ghostscript.
@jeroen, could you please back up your statement with (at least one) sample PDF file(s) where this is evident? Which minimal Poppler version renders "better results" as compared to which version of Ghostscript? And have you also compared to MuPDF?
(I'm seriously interested to find out more details about this, should I get a starting point somewhere...)
Here is the example code that I use in my R bindings to render pdf: https://github.com/ropensci/pdftools/blob/master/src/bindings.cpp#L293-L318
re: quality I don't know the details, but poppler is widely used and I have gotten really good results. Also it's more portable than ghostscript because it's a library.
@jeroen:
Well, your latest comment now sounds a bit different. In August 2016 you had stated that Poppler had "neat PDF rendering capabilities with better results than ghostscript".
Now it boils down to "poppler is widely used and I have gotten really good results."
I also like Poppler very much, and get really good results. Especially I like its CLI tools, which I use daily. Same with Ghostscript.
So I was really thinking you had some good examples which I could further investigate.
You further stated:
"Also it's more portable than ghostscript because it's a library."
This one is not really a valid argument. Because Ghostscript is extremely portable as well. AND it can be built and used as a library too ('gslib'). Also Ghostscript you can get pre-compiled by its developers for Windows. Which is not the case for Poppler.
You may have a point when it comes to the usability of both the respective libraries (Poppler's as well as Ghostscript's) and their API from a developer's point of view. This aspect I'm not competent to make a judgement about, since I'm not a developer.
Anyway, thanks for following up and responding to my question.