How to Use IronPdfEngine

IronPdfEngine is a gRPC server crafted to oversee a range of IronPDF tasks, encompassing the creation, editing, and reading of PDF documents.

Node.js Library for PDF

Install with npm

 npm i @ironsoftware/ironpdf

IronPdf Node.js and IronPdfEngine

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

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

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

IronPdf for Node.js 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.

npm i @ironsoftware/ironpdf

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 Node.js 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

npm install @ironsoftware/ironpdf-engine-windows-x64

For Windows x86

npm install @ironsoftware/ironpdf-engine-windows-x86

For Linux x64

npm install @ironsoftware/ironpdf-engine-linux-x64

For macOS x64

npm install @ironsoftware/ironpdf-engine-macos-x64

For macOS arm

npm install @ironsoftware/ironpdf-engine-macos-arm64

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

Pros

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

Cons

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

IronPdf for Node.js with Remote IronPdfEngine

To use remote IronPdfEngine a specific version of IronPdfEngine is needed. For example, if the IronPdf for Node.js version 2024.2.2 requires IronPdfEngine version 2024.2.2. Do not use IronPdfEngine version 2024.2.1. Access the ironPdfEngineVersion property to check for the version needed.

const ironPdfEngineVersion = IronPdfGlobalConfig.ironPdfEngineVersion;
JAVASCRIPT

How to connect

Assume that IronPdfEngine run 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).

IronPdfGlobalConfig.setConfig({
    ironPdfEngineDockerAddress:"123.456.7.8:33350"
});
JAVASCRIPT

Simple as that! After this your application will be connected 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."