How to Use IronPdfEngine

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

Link to Download IronPDF for Java on ironpdf.com

IronPdf for Java and IronPdfEngine

IronPdf for Java requires IronPdfEngine to run. The Java code serves as an API mask over IronPdfEngine gRPC. When you invoke any method in IronPdf for Java, the actual processing occurs inside IronPdfEngine!

By default, IronPdf for Java will spawn IronPdfEngine as a subprocess and interact with it until your application shuts down.

Please note
Each version of IronPdf for Java requires a specific version of IronPdfEngine. Cross-version compatibility is not supported.

IronPdf for Java with Local IronPdfEngine

Option 1: Download IronPdfEngine at Runtime

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

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf</artifactId>
    <version>20xx.xx.xx</version>
</dependency>
<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 startup time.

Option 2 (recommended): Install IronPdfEngine as a Dependency

IronPdf Java allows you to add IronPdfEngine directly as a dependency. These dependencies wrap IronPdfEngine into a .zip file, automatically extracting and using it.

You can choose to install one or more of these IronPdfEngine dependencies.

Please note
ironpdf and ironpdf-engine-xxx-xxx dependency version must be the same. ironpdf-engine-xxx-xxx does not refer to the IronPdfEngine's internal version.

For Windows x64

<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-windows-x64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
<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>
<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>
<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>
<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>
<dependency>
    <groupId>com.ironsoftware</groupId>
    <artifactId>ironpdf-engine-macos-arm64</artifactId>
    <version>20xx.xx.xxxx</version>
</dependency>
XML

Please note
Each dependency is quite large, so installing them all is not advisable.

Pros

  • Faster startup time.
  • Internet access is not needed after the dependency is installed.

Cons

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

IronPdf for Java with Remote IronPdfEngine

To use a remote IronPdfEngine, a specific version is necessary. For example, if IronPdf for Java version 2024.2.2 requires IronPdfEngine version 2024.2.2, do not use version 2024.2.1. Use the getIronPdfEngineVersion method to verify the required version.

// Get the version of the IronPdfEngine needed for the current Java version
String ironPdfEngineVersion = Settings.getIronPdfEngineVersion();
// Get the version of the IronPdfEngine needed for the current Java version
String ironPdfEngineVersion = Settings.getIronPdfEngineVersion();
JAVA

How to Connect

Assume that IronPdfEngine is running remotely at 123.456.7.8:33350.

Refer to Instructions on How to Pull and Run IronPdfEngine

To connect, specify the location of IronPdfEngine (ensure the address is accessible and not blocked by firewalls). Add this code during the initial stage of your application (or just before invoking any IronPdf method).

// Set the host and port for a remote IronPdfEngine connection
com.ironsoftware.ironpdf.Settings.setIronPdfEngineHost("123.456.7.8");
com.ironsoftware.ironpdf.Settings.setIronPdfEnginePort(33350);
// Set the host and port for a remote IronPdfEngine connection
com.ironsoftware.ironpdf.Settings.setIronPdfEngineHost("123.456.7.8");
com.ironsoftware.ironpdf.Settings.setIronPdfEnginePort(33350);
JAVA

Simple as that! After executing this code, your application connects 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."

Frequently Asked Questions

What is a gRPC server used for in Java PDF management?

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

How do I set up a server for PDF operations in Java?

To install IronPdfEngine for use in Java, you need to include the IronPDF Java library in your project and configure the host and port using the `setIronPdfEngineHost` and `setIronPdfEnginePort` methods.

Why is a separate server required for Java PDF libraries?

IronPdf for Java requires IronPdfEngine to run because the Java code serves as an API mask over IronPdfEngine gRPC. The actual processing occurs inside IronPdfEngine.

What are the options for using a PDF server locally in Java?

You can use IronPdfEngine locally by either allowing IronPdf to download the necessary binaries at runtime or by installing IronPdfEngine as a dependency directly in your project.

Can I use different software versions for Java PDF management and its server?

No, each version of IronPdf for Java requires a specific version of IronPdfEngine. Cross-version compatibility is not supported.

How can I connect to a remote server for PDF operations in Java?

To connect to a remote IronPdfEngine, specify the host and port using the `setIronPdfEngineHost` and `setIronPdfEnginePort` methods. Ensure that the server address is accessible and not blocked by firewalls.

What are the pros and cons of downloading PDF server binaries at runtime?

Pros include a smaller application package and the ability to deploy on many platforms. Cons include the need for internet access on the first run and a slower startup time.

What are the benefits of installing a PDF server as a dependency?

Installing IronPdfEngine as a dependency results in faster startup times and no need for internet access after installation. However, it increases the size of your application package and requires targeting specific platforms.

How do I verify the required server version for my Java PDF library?

Use the `getIronPdfEngineVersion` method to verify the required version of IronPdfEngine for your current Java version.

Is it necessary to install a PDF server as a dependency for remote usage?

No, for remote IronPdfEngine usage, installing IronPdfEngine as a dependency is not necessary.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.
Talk to an Expert Five Star Trust Score Rating

Ready to Get Started?