How to Use IronPdfEngine
IronPdfEngine is a gRPC server designed to manage various IronPDF operations, including creating, writing, editing, and reading PDFs.
How to Use IronPdfEngine as a Remote Server
- Install the Java library to utilize IronPdfEngine
- Include the library in the pom.xml file
- Utilize the setIronPdfEngineHost method to configure Host
- Utilize the setIronPdfEnginePort method to configure Port
- Use the IronPdfEngine to render HTML to PDF with an identical to Chrome renderer
Install with Maven
Download JAR
Manually install into your project
IronPdf for Java 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
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>
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
Option 2 (recommended) install IronPdfEngine as a dependency
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>
For Windows x86
<dependency>
<groupId>com.ironsoftware</groupId>
<artifactId>ironpdf-engine-windows-x86</artifactId>
<version>20xx.xx.xxxx</version>
</dependency>
For Linux x64
<dependency>
<groupId>com.ironsoftware</groupId>
<artifactId>ironpdf-engine-linux-x64</artifactId>
<version>20xx.xx.xxxx</version>
</dependency>
For macOS x64
<dependency>
<groupId>com.ironsoftware</groupId>
<artifactId>ironpdf-engine-macos-x64</artifactId>
<version>20xx.xx.xxxx</version>
</dependency>
For macOS arm
<dependency>
<groupId>com.ironsoftware</groupId>
<artifactId>ironpdf-engine-macos-arm64</artifactId>
<version>20xx.xx.xxxx</version>
</dependency>
Please note
Pros
- Faster start up time.
- Internet access is not 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();
How to connect
Assume that IronPdfEngine is up and running remotely at 123.456.7.8:33350
Please note
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);
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."