views:

977

answers:

7

I'm looking for a (preferably LGPL'ed) PDF-rendering library that I can use on Mac OS X, Windows and Linux using C++.

So far I found:
(updated with content from answers below)

  • Poppler
    • GPL
    • very easy to use
    • Qt4-backend
  • GhostScript
    • GPL (depending on the version of GhostScript)
    • command line only
    • does not support PDF boxes
  • MuPDF (Sumatra)
    • A drama to compile on its own (uses DARCS and Jam)
    • Based on GhostScript (Fitz)
    • Seems to be what Palm (WebOS) is using.
  • PDFTron
    • Commercial (did not test it): $1,000 per CPU socket
  • Adobe PDF-Library
    • very expensive: $25,000 once + $5,000 yearly per platform
    • complex to use

Thanks in advance!

A: 

I believe there must be XSL-FO implementations in C++ If you don't mind running a separate process from command line, you may consider using iText, Apache FOP or PDFJet

Dmitry
I already ruled out calling command line tools (like GhostScript) for technical reasons. I consider command line utilities as a last resort if I don't find a fitting library for C/C++.
BastiBense
What about PDFkit and xpdf? I think they are written in C++ and xpdf seems to be available on Mac and Windows
Dmitry
PDFKit was obsoleted in favor of PopplerKit on the GNUStep project. It's no longer maintained, AFAIK. Xpdf was, to my understanding, written in C, and projects like KPDF ditched it in favor of QT-Poppler.
greyfade
+2  A: 

Poppler is extremely easy to use, and it comes with a few different renderer classes that you can use as a basis for your own. I highly recommend it for quick-and-dirty projects.

Ghostscript I found extremely difficult to use correctly, and writing an output driver is a very error-prone process. Avoid it.

Another you can look at is Sumatra, which, I understand, is faster and more light-weight than Poppler (though I've not investigated it).

I'm personally unaware of any LGPL'd libraries.

greyfade
+1  A: 

There are quite a few Java libraries (PDFRenderer, IcePdf, JPedal) under LGPL licenses which run nicely on the Mac and cross platform.

mark stephens
Links would be nice ... They seems to be https://pdf-renderer.dev.java.net/ , http://www.icepdf.org/ , and http://www.jpedal.org/ . Java is not C++, but starting a jvm from the c++ program and communicating with it through native code might be feasible.
Rasmus Kaj
(by "native code", I mean JNI)
Rasmus Kaj
+1  A: 
danio
@danio: podofo's libary part (see my answer) is C++ and LPGL.
pipitas
@pipitas like BastiBense says, PoDoFo doesn't render
danio
A: 

See PDFTron. We use it for in our document imaging system. It does the job well and it wasn't to pricey (~$1000 per CPU socket, not core).

HTH

unclepaul84
A: 

Sumatra PDF Viewer (http://blog.kowalczyk.info/software/sumatrapdf/develop.html) uses MuPDF.

pelesl
+1  A: 

Not to forget podofo.

  • Library is licensed under LGPL (as requested).
    That means: you may even use its shared library in closed sourced applications).
    (Standalone CLI utility tools that are part of the podofo package are GPL though.)
  • C++ as requested.
  • Cross-platform as requested.
pipitas
Unfortunately PoDoFo is a set of tools and a parser. It does not *render* PDF files to bitmaps. But thanks for the late answer, anyway. :)
BastiBense
@BastiBense: D'uh! I overlooked your *PDF-rendering* part. My eyes were only on the multiplatform-, C++- and LPGL-parts, and my mind invented a "PDF-manipulating" part.
pipitas