JagPDF
Prev Up Home Next

JagPDF is implemented as a shared library. Language bindings provided with JagPDF expose the library functionality to individual programming languages. If you install JagPDF in a standard way (i.e. from source, DEBs, or Python's distutils) the installation process places JagPDF files into proper locations and hence makes JagPDF available to your applications.

If you install JagPDF manually then you have to ensure that the library is visible to your environment.

[Tip]

The following articles provide more information about shared libraries on individual platforms.

You can enable JagPDF in your application by including the main header file:

#include <jagpdf/api.h>

To compile and link your application with JagPDF you need to

  • Point the compiler to the JagPDF include files.
  • Point the linker to jagpdf.so on Linux or jagpdf-1.4.lib on Windows.

The following table shows how to compile and link JagPDF with two popular compilers:

Compiler

Command Line

GCC

gcc -I<jagpdf-include-dir> -L<jagpdf-lib-dir> <your-files> -ljagpdf

MSVC

cl.exe /I<jagpdf-include-dir> <your-files> jagpdf-1.4.lib /link /LIBPATH:<jagpdf-lib-dir>

C++ API vs. C API

JagPDF provides two separate APIs - one to be used by pure C applications and one for C++ applications. There are no differences between these two as far as the feature set is concerned. The C++ API just offers features that are inherent to C++: object oriented approach with automatic object lifetime management, method overloading, error handling using exceptions (optional), etc. Of course, a C++ application can still use the C API.

[Note]

Even if you downloaded a prebuilt library you can still use any standard conforming C++ compiler. JagPDF implements the C++ API using a C bridge between your C++ application and JagPDF. The C bridge works around the fact that there is no unified C++ ABI embraced by all compiler vendors.

Now you can proceed to your first application in C++ or C.

If you installed from source or DEBs then your environment should be ready. The prebuilt all-in-one package supports distutils, so you can install it by doing

$ python setup.py install

Now you can proceed to your first application.

JagPDF for Java is implemented as a JNI module. It is compatible with JDK 1.4 and later. It is known to work with Sun's JVM and OpenJDK, and it should work with any JVM implementation with JNI support.

The JagPDF functionality is provided in namespace com.jagpdf. To compile and run your application, point the classpath to jagpdf-1.4.jar:

$ javac -classpath /path/to/jagpdf-1.4.jar <your_java_files>
$ java -classpath /path/to/jagpdf-1.4.jar <your_app>

If you install from DEB you should use the following:

$ export LD_LIBRARY_PATH=/usr/lib/jni:$LD_LIBRARY_PATH
$ javac -classpath /usr/share/java/jagpdf.jar <your_java_files>
$ java -classpath /usr/share/java/jagpdf.jar <your_app>

Now you can proceed to your first application.

Prev Up Home Next