Skip to content

Building From Source

Patrick Corless edited this page Feb 24, 2025 · 5 revisions

The icepdf jars can be found on maven central for seamless integration into your build tool of choice.

Maven Build

Maven can be used to build the ICEpdf core, viewer and example modules. This build does not build the distribution package, the Gradle build can be used for this if desired. The reactor build order of the maven project looks as follows:

------------------------------------------------------
 Reactor Build Order:

 ICEpdf :: Core :: Core Swing/AWT
 ICEpdf :: Core
 ICEpdf :: Viewer : Swing/AWT Viewer RI
 ICEpdf :: Viewer
 ICEpdf :: Examples :: Annotation :: Callback
 ICEpdf :: Examples :: Annotation :: Creation
 ICEpdf :: Examples :: Annotation
 ICEpdf :: Examples :: Capture :: Listener
 ICEpdf :: Examples :: Capture :: PNG
 ICEpdf :: Examples :: Capture :: Portfolio
 ICEpdf :: Examples :: Capture :: TIFF
 ICEpdf :: Examples :: Capture :: Watermark
 ICEpdf :: Examples :: Capture
 ICEpdf :: Examples :: Component Swing/AWT
 ICEpdf :: Examples :: Extraction :: Images
 ICEpdf :: Examples :: Extraction :: Metadata
 ICEpdf :: Examples :: Extraction :: Text
 ICEpdf :: Examples :: Extraction
 ICEpdf :: Examples :: JavaFx
 ICEpdf :: Examples :: Loading Events
 ICEpdf :: Examples :: Print Services
 ICEpdf :: Examples :: Search :: Highlight
 ICEpdf :: Examples :: Search :: Headless
 ICEpdf :: Examples :: Search
 ICEpdf :: Examples :: Signatures
 ICEpdf :: Examples :: SVG Capture
 ICEpdf :: Examples
 ICEpdf

From the reactor summary above it can be see then the three main modules are core, viewer and examples. Each can be build individually if desired.

# core module
~$ mvn -pl :icepdf-core package

# viewer module, -am insures dependencies are build 
~$ mvn -pl :icepdf-viewer -am package

# examples module, -am insures dependencies are build 
~$ mvn -pl :png-capture -am package
# or with full group id. 
~$ mvn -pl org.icepdf.os.examples:png-capture -am package

And of course the whole project hierarchy can be built with:

# or with full group id. 
~$ mvn package

Versioning and Publishing

When working with ICEpdf source it common to install compiled core and viewer jars into a local repository. The maven command for install is a as follows:

# Install icepdf-core.jar in local repository
~$ mvn -pl :icepdf-core install
# Install icepdf-viwer.jar in local repository
~$ mvn -pl :icepdf-viewer install

Version information is store in the root projects pom.xml and can be updated as needed before installing the jars into a local repository

Gradle Build

Gradle can be used to build the ICEpdf core, viewer and example projects. The project summary is as follows:

------------------------------------------------------------
Root project
------------------------------------------------------------

Root project 'icepdf'
+--- Project ':core'
|    \--- Project ':core:core-awt' - ICEpdf core library jar project
+--- Project ':examples'
|    +--- Project ':examples:annotation'
|    |    +--- Project ':examples:annotation:callback' - aannotation callback example
|    |    \--- Project ':examples:annotation:creation' - annotation creation example
|    +--- Project ':examples:capture'
|    |    +--- Project ':examples:capture:listener' - direcotry listener for auto image capture
|    |    +--- Project ':examples:capture:png' - pdf to png image example
|    |    +--- Project ':examples:capture:portfolio' - portfolio pdf to png image example
|    |    +--- Project ':examples:capture:svg' - pdf to svg example
|    |    +--- Project ':examples:capture:tiff' - pdf to tiff image example
|    |    \--- Project ':examples:capture:watermark' - pdf to png image with watermark example
|    +--- Project ':examples:component' - viewer component example
|    +--- Project ':examples:extraction'
|    |    +--- Project ':examples:extraction:image' - document image extraction example
|    |    +--- Project ':examples:extraction:metadata' - document metadata extraction example
|    |    \--- Project ':examples:extraction:text' - document text extraction example
|    +--- Project ':examples:javafx' - javafx SwingNode example
|    +--- Project ':examples:loadingEvents' - page loading event example
|    +--- Project ':examples:printservices' - java print services example
|    +--- Project ':examples:search'
|    |    +--- Project ':examples:search:component' - search highlight example
|    |    \--- Project ':examples:search:headless' - headless search highlight example
|    \--- Project ':examples:signatures' - signature validation example
\--- Project ':viewer'
     \--- Project ':viewer:viewer-awt' - ICEpdf viewer reference implementation project

Build the core jar using the following Gradle command

~$ gradle :core:core-awt:assemble 

Build the viewer jar using the following Gradle command

~$ gradle :viewer:viewer-awt:assemble 

Build the annotation creation example using the following Gradle command

~$  gradle :examples:annotation:creation:assemble

Build the distribution zip and tar archives

# defaultTasks allows for a call to just gradle 
~$ gradle
# or one can use the full task list 
~$ gradle projectReport, sourcesJar, genPomFileForCoreJarPub, genPomFileForViewerJarPub, osDistZip, osDistTar
Clone this wiki locally