Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open Source PDF Tools in C/C++

1,410 views
Skip to first unread message

dave

unread,
Apr 9, 2007, 5:51:37 AM4/9/07
to
Are there any open source PDF C/C++ programs for
manipulating PDF files?

Thanks,
Dave Feustel

chicks

unread,
Apr 9, 2007, 10:37:57 AM4/9/07
to

There's libharu for creating PDFs. Also, Sid Steward (PDF Hacks)
demonstrates how to compile the iText java PDF library and use it from
C/C++ with his pdftk. Finally, there the .NET port of the iText
library, usable from any .NET language.

dave

unread,
Apr 9, 2007, 3:48:47 PM4/9/07
to

Java and .NET tools are not available on OpenBSD now. Java may become
available, but only C/C++ are likely to be useful on OpenBSD - and I'm
not interested in switching. I can generate PDF using TeX. For the
files I generate I don't need tools since I have the original TeX
source files.

chicks

unread,
Apr 9, 2007, 4:43:26 PM4/9/07
to
On Apr 9, 12:48 pm, dave <d...@a64.localhost.comcast.net> wrote:

> Java and .NET tools are not available on OpenBSD now. Java may become
> available, but only C/C++ are likely to be useful on OpenBSD - and I'm
> not interested in switching. I can generate PDF using TeX. For the
> files I generate I don't need tools since I have the original TeX
> source files.

OK, your original post didn't specify OpenBSD. However, you don't
need Sun's JDK to compile iText/pdftk, you need gcc/gcj. This site
has a port of pdftk to FreeBSD (I don't know the diff between the
two): http://www.freshports.org/print/pdftk/


dave

unread,
Apr 10, 2007, 8:33:46 AM4/10/07
to
Gcj does not seem to be available with OpenBSD 4.0.

vasudevram

unread,
Apr 11, 2007, 1:24:41 PM4/11/07
to
On Apr 10, 5:33 pm, dave <d...@a64.localhost.comcast.net> wrote:


PDFLib - http://www.pdflib.com - has an open source version - but
that's only for non-commercial or personal use, IIRC.
A very good quality product. There's also a paid version.

I'm not sure what you mean by "manipulate"? Normally that would mean
things like merge/split/extract, add watermark, etc. but do you also
mean creation of PDF files? For creation, other than libharu, I don't
know of any native C/C++ options - other than Adobe's SDK.

There are some possible workarounds though - use a good PDF library
for any other language, and call it from C/C++ using some distributed
technology such as sockets, XML-RPC, SOAP, etc. May not be very good
performance (though I'd think if both the client and the server are on
the same PC and its a reasonably fast modern one, shouldn't be too
slow), but should get the job done unless you have high performance or
volume needs.

What you'd have to do here is write the PDF-generating class / module
in some language which has a good PDF creation library, say Java
(iText library) or Python (ReportLab library) or Ruby (PDF::Writer
library), then make that class or classes into servers (say XML-RPC
servers) and then write an XML-RPC client in C/C++ to call the server
functionality. A bit roundabout, I know, but it should work. If all
you need is to generate PDFs from plain text, you might want to take a
look at my xtopdf toolkit (see URL below) which is a thinnish wrapper
over the ReportLab library (for text-to-PDF only, no image support,
etc.), but can be handy for certain kinds of text-to-PDF creation,
e.g. it takes care of pagination, you can add custom headers and
footers, set the font, etc. So it could save you some coding over
using raw ReportLab, if using Python. Of course you can also use
xtopdf with the XML-RPC approach outlined above, since its written
using classes and objects. The main class is PDFWriter. Xtopdf is
pretty easy to learn and use - just check the examples that come with
the package.

HTH
Vasudev Ram
http://www.dancingbison.com
http://sourceforge.net/projects/xtopdf


0 new messages