How to Use IronPdfEngine

IronPdfEngine is a gRPC server designed to manage various IronPDF operations, including creating, writing, editing, and reading PDFs.

Java Maven Library for PDF

Install with Maven

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>2024.6.2</version>
</dependency>
or
Java PDF JAR

Download JAR

  Download JAR

Manually install into your project

IronPdf .NET and IronPdfEngine

IronPdf for Java require IronPdfEngine to run. The Java code is just a API mask over IronPdfEngine gRPC. So when you call any method in IronPdf for Java the magic will happen inside IronPdfEngine!

By default IronPdf for Java will spawn IronPdfEngine as a subprocess and talk to it until your application was shutdown.

Please note
Each version of IronPdf for Java required a specific version of IronPdfEngine. Cross-version are not suppoted.

IronPdf for Java with Local IronPdfEngine

Option 1 download IronPdfEngine in the runtime

By default, after you install IronPdf in your Java project, on the first run, IronPdf will detect your platform (e.g., Windows x64) and download the correct IronPdfEngine binaries from the internet.

<dependency>
   <groupId>com.ironsoftware</groupId>
   <artifactId>ironpdf</artifactId>
   <version>20xx.xx.xx</version>
</dependency>
XML

Pros

  • Your application package will be small.
  • Can deploy on many platforms

Cons

  • Internet access is needed on the first runs
  • Slow start up time

IronPdf Java allows you to add IronPdfEngine as a dependency. These IronPdfEngine dependencies bundle IronPdfEngine to a .zip file and will extract and use automatically.

You may choose to install one or multiple of these IronPdfEngine dependencies.

Please note
ironpdf and ironpdf-engine-xxx-xxx dependency version must be the same.

ironpdf-engine-xxx-xxx dependency version does not refer to the version of IronPdfEngine inside.

For Windows x64

 <dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

For Windows x86

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x86</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

For Linux x64

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-linux-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

For macOS x64

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

For macOS arm

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-arm64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

Please note
Each dependency is quite huge, not a good idea to install them all.

Pros

  • Faster start up time.
  • Internet access is no needed after the dependency was installed.

Cons

  • Your application package will be large.
  • Need to specify the target platforms.

IronPdf for Java with Remote IronPdfEngine

To use remote IronPdfEngine a specific version of IronPdfEngine is needed. For example, if the IronPdf for Java version 2024.2.2 requires IronPdfEngine version 2024.2.2. Do not use IronPdfEngine version 2024.2.1. Use the getIronPdfEngineVersion method to check for the version needed.

string ironPdfEngineVersion = Settings.getIronPdfEngineVersion();
JAVA

How to connect

Assume that IronPdfEngine is up and running remotely at 123.456.7.8:33350

Please note
To run IronPdfEngine remotely, please refer to "How to Pull and Run IronPdfEngine."

You just need to tell IronPdf where IronPdfEngine is (please make sure that address is accessible, not blocked by firewall). Add this code at the initial stage of your application (or just before calling any IronPdf method).

com.ironsoftware.ironpdf.Settings.setIronPdfEngineHost("123.456.7.8");
com.ironsoftware.ironpdf.Settings.setIronPdfEnginePort(33350);
JAVA

Simple as that! After this your application will be connected to the Remote IronPdfEngine!

For remote IronPdfEngine, installing IronPdfEngine as a dependency is not needed. You can skip the section titled "Option 2 (recommended) install IronPdfEngine as a dependency."