Package com.coherentpdf


package com.coherentpdf

Jcpdf is a Java interface to the cpdf pdf tools. More information, including commercial licenses can be found at https://www.coherentpdf.com/

The sofware is free for non-commercial use. The non-commercial home of this software is https://community.coherentpdf.com/

Obtaining and installing the DLLs

The DLLs "cpdf" and "jcpdf" are required. The "cpdf" DLL is free for non-commercial use. Commercial use requires a license. The DLLs can be obtained here for all platforms here:

https://github.com/coherentgraphics/cpdflib-binary

Before using the library, you must make sure your project or build environment has access to the jcpdf and cpdf DLLs, which are not part of the Java .jar.

The java library invokes LoadLibrary on the jcpdf DLL, and so it must be placed in your java.library.path. The cpdf DLL itself will be searched for not by Java, but by your system, as a dependency of jcpdf.

Windows Files should be named jcpdf.dll and libcpdf.dll. Put jcpdf.dll in your java.library.path and then libcpdf.dll in the same folder, or in a standard location such as System32.

Linux Files should be named libjcpdf.so and libcpdf.so. Put libjcpdf.so in your java.library.path. You must put libcpdf.so in a standard location such as /usr/local/lib, or set LD_LIBRARY_PATH. Simply putting it in the same folder as libjcpdf.so will not work.

MacOS Files should be named libjcpdf.dylib and libcpdf.so. Put libjcpdf.dylib in java.library.path. You can put libcpdf.so in the same folder - it will be picked up automatically.

Documentation

Full manual (required reading): https://coherentpdf.com/jcpdflibmanual.pdf

Follow the instructions at the end of Chapter 1 to write your first program.

In addition, the Jcpdf package provides documentation with each function, which you can view in your IDE.

Usage

Create an instance of the library with, for example Jcpdf.jcpdf = new Jcpdf(). You must call startup() to initialise the library prior to calling any other function.

PDFs are of type Jcpdf.Pdf. Page ranges are of type Jcpdf.Range. Both PDFs and ranges are not automatically garbage-collected. Use try or the close() method to dispose of them.

Exceptions are of type Jcpdf.CpdfError and may be raised by any function.

Contact

mailto:contact@coherentgraphics.co.uk

Bug reports: https://github.com/coherentgraphics/jcpdf

  • Class
    Description
    The Coherent PDF Library for Java
    Any function in this library may raise the CpdfError exception, which carries a string describing the nature of the problem.