libpdfdoc Project Home Page



libpdfdoc is a library to access PDF (Portable Document Format). It provides classes and functions for reading and writing to PDF files.



libpdfdoc is release under GPL v2. In short, it is Free Software. I am not responsible for any damage it may make. You can change it, sell it, distribute it. As libpdfdoc contains some code borrow from GPL project, the license is GPL v2 as a whole. As it is NOT LGPL, it is not legal to use it in proprietary projects.

Note that it is not "GPL v2 or later". The GPL v3 does not apply to this library.

Getting libpdfdoc

libpdfdoc can be downloaded in from sourceforge. The latest snapshot is also available in the git repository hosted in sourceforge. To access the repository, configure you git clients to clone from git:// See here for more details.


libpdfdoc depends on the following libraries:

These are available for all major Linux distributions. For Win32 platforms, most of the libraries (zlib, Freetype, libpng) can be downloaded from the GNU Win32 project. For Boost, BoostPro Computing provides pre-built libraries with a nice installer for Win32.


libpdfdoc is available at sourceforge.

Building libpdfdoc

libpdfdoc uses the cmake build system to produce makefiles for different development platforms. The cmake build system will automatically detect the location of the dependency libraries and adjust the include and library path of the project. In most unix-like environment, the command:

cmake -G 'Unix Makefiles' /path/to/libpdfdoc/

should be enough to generate the makefiles to build the project. It is also possible to use cmake to generate project files of other build environments, e.g. MS Visual Studio or eclipse, depending on your platform. Afterwards, just type make to build. cmake by default will not show the actual command line of the compiler. To see it, type this command:

VERBOSE=1 make

This will show the full command line of the compiler. It is useful for troubleshooting compiler issues.

cmake also supports Microsoft Visual Studio. Just use a different makefile generator for the version of VS. For example, for VS 2005:

cmake -G 'Visual Studio 8 2005' c:\path\to\libpdfdoc\

You may have to add -DCMAKE_PREFIX_PATH=c:\path\to\libraries to the cmake command line to make sure it can find the library dependencies. You can also use -DBOOST_ROOT=c:\path\to\boost\library to specify the path to the boost library.

cmake recommends separating the source code directory and the build directory. Suppose the libpdfdoc source code is located at c:\code\libpdfdoc, and you want to create the VS project files at c:\build\libpdfdoc, you may want to run the following commands:

C:\build\libpdfdoc>cmake -G "Visual Studio 8 2005" \
                         -DBOOST_ROOT=c:\path\to\boost\library \
                         -DCMAKE_PREFIX_PATH=c:\path\to\other\libraries \
                         -DCPPUNIT_PREFIX=c:\path\to\cppunit \


See the Getting Started page for a simple tutorial for using the library.

Hosted by SourceForge Logo