Support and resources

Samples & Documentation

Contact Support Engineers

Samples and Documentation

Code Samples

The latest samples for PDF4Java are available on GitHub here:

https://github.com/pdf4dev-solutions/pdf4java

How to use the PDF4Java library from command line:

Replace x.y.z.w with your JAR version number in these commands.

  1. 1. Include the library JAR in the classpath when compiling:

    javac -cp .;/path/to/PDF4Java-x.y.z.w.jar Application.java
  2. 2. Specify the library paths when running the application:

    java.exe -Djava.library.path=/path/to/library/ -classpath .;/path/to/library/PDF4Java-x.y.z.w.jar Application

How to use the PDF4Java library with Maven:

Use your JAR version in place of x.y.z.w. The install commands use Windows line continuation (^); on Linux, use \ instead.

  1. 1. Install each library into your local Maven repository:

    mvn install:install-file ^
        -Dfile=/path/to/library/PDF4Java-x.y.z.w.jar ^
        -DgroupId=com.o2sol ^
        -DartifactId=pdf4java ^
        -Dversion=x.y.z.w ^
        -Dpackaging=jar ^
        -DgeneratePom=true
    
    mvn install:install-file ^
        -Dfile=/path/to/library/PDF4Java.Cmaps-x.y.z.w.jar ^
        -DgroupId=com.o2sol ^
        -DartifactId=pdf4java.cmaps ^
        -Dversion=x.y.z.w ^
        -Dpackaging=jar ^
        -DgeneratePom=true
    
    mvn install:install-file ^
        -Dfile=/path/to/library/PDF4Java.Render-x.y.z.w.jar ^
        -DgroupId=com.o2sol ^
        -DartifactId=pdf4java.render ^
        -Dversion=x.y.z.w ^
        -Dpackaging=jar ^
        -DgeneratePom=true
  2. 2. Add the library dependencies to pom.xml:

    <dependencies>
      <dependency>
        <groupId>com.o2sol</groupId>
        <artifactId>pdf4java</artifactId>
        <version>x.y.z.w</version>
      </dependency>
      <dependency>
        <groupId>com.o2sol</groupId>
        <artifactId>pdf4java.cmaps</artifactId>
        <version>x.y.z.w</version>
      </dependency>
      <dependency>
        <groupId>com.o2sol</groupId>
        <artifactId>pdf4java.render</artifactId>
        <version>x.y.z.w</version>
      </dependency>
    </dependencies>

NOTE:

The samples provided here and on GitHub are for educational purposes only, to help developers understand and use PDF4Java library more effectively. However, they are provided AS-IS with no support or warranties expressed or implied. If you discover a problem, send an email to techsupport@pdf4dev.com and we'll try to fix it.

FAQ