IronPDF NestJS TypeScript Build Errors

Adding the IronPDF Node.js SDK to a NestJS project causes TypeScript to fail at compile time:

Type '{ maxHeight?: number; htmlFragment?: string; ... }' is not assignable to type 'HtmlAffix'.

Zod schema declarations inside the IronPDF SDK (affixSchema.ts, imageSchema.ts, pageSchema.ts) define types that do not match the expected object shapes in NestJS TypeScript builds. NestJS enforces stricter module resolution than a plain Node.js project, which surfaces these internal mismatches at compile time.

Solution

Run IronPdfEngine as a Docker container and configure the SDK to connect to it over HTTP. This removes the IronPDF SDK's Zod types from NestJS module resolution, stopping the build failures.

Start the IronPdfEngine container:

docker run -p 5000:33350 ironsoftwareofficial/ironpdfengine:2025.6.5
docker run -p 5000:33350 ironsoftwareofficial/ironpdfengine:2025.6.5
SHELL

Configure IronPDF to use the container:

import { IronPdfGlobalConfig } from "@ironsoftware/ironpdf";

IronPdfGlobalConfig.getConfig().ironPdfEngineDockerAddress = "http://localhost:5000";

Use IronPDF normally from a NestJS service:

import { PdfDocument } from "@ironsoftware/ironpdf";

const pdf = await PdfDocument.fromHtml("<h1>Hello PDF</h1>");
await pdf.saveAs("output.pdf");

With the engine running in Docker, the NestJS application calls IronPdfEngine over HTTP. The SDK's internal Zod type declarations no longer participate in the TypeScript compilation.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Version: 2026.5 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your HTML become a PDF.