This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/document-engine/release-notes/1-21.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. 1.21 release notes

1.21 release notes

RSS

Document Engine 1.21 improves HTML-to-PDF conversion, recovers better from database overload, and makes viewing faster for deployments without Redis.

Before attempting to upgrade to Document Engine 1.21, make sure your application runs as expected on your current version. If you’re on version 1.6.1 or later, you can upgrade directly to 1.21. If you’re on an earlier version, follow the step-by-step upgrade path outlined in our upgrade(opens in a new tab) guide.

Highlights

This release focuses on HTML-to-PDF conversion, recovery from database overload, and faster viewing.

Better HTML-to-PDF conversion

HTML parts can wait for JavaScript before printing; add headers, footers, and page numbers with CSS; and fail clearly when a resource or script breaks instead of returning an incomplete PDF. See HTML rendering options.

Steadier under load

Document Engine now recovers from temporary database overload instead of shutting down, and PDF workers return to service after a period of overload. See recovery from temporary database overload and PDF workers return after a period of overload.

Faster viewing

Deployments without Redis now reuse rendered tiles and document information from the in-memory cache instead of rendering them again on every request. Prerendered first pages are served from the cache to current Nutrient Web SDK viewers.

Breaking changes

This release includes the following breaking changes.

Word conversion errors

When the converter confirms that a Word file is invalid or corrupt, direct uploads, PDF/A or PDF/UA validation, and Build inputs converted before part processing now return HTTP 400 instead of HTTP 500. Direct uploads and PDF/A or PDF/UA validation return the reason invalid_docx; Build and uploads with Build instructions list the affected input or instruction in failingPaths.

A Build part that converts its own file — for example, because it sets markup_mode — already returned HTTP 400 for a confirmed invalid Word file. Its failingPaths details now identify the invalid input. Conversion failures that aren’t confirmed invalid or corrupt still return HTTP 500 for direct uploads and some Build outputs, such as PDF/A. The body is Internal error instead of the converter’s raw output. A Build part that converts its own file still returns HTTP 400 with the message Conversion failed. for these errors. Overload still returns HTTP 503, and timeouts still return HTTP 408.

Clients that handled the previous HTTP 500 for corrupt Word files or that read the previous error text need to update.

Mesa and libglvnd removed from the Docker image

The Document Engine Docker image no longer contains x11-utils, the libglvnd libraries (libgl1, libglvnd0, and libglx0), or the Mesa graphics packages (libgbm1, libgl1-mesa-dri, libglx-mesa0, and mesa-libgallium). Document Engine runs Chromium headless without GPU access and doesn’t use them. The image is approximately 190 MB smaller, and image scanners no longer report findings for these packages.

The chromium and chromium-common packages in the image no longer depend on x11-utils and libgbm1. Chromium loads a stub libgbm from the nutrient-chromium-gbm-stub package instead. Only Chromium uses this stub.

Deployments that use the published image see no change. If you build an image on top of the Document Engine image and install packages that need these libraries, those libraries are installed as usual. If you need x11-utils itself, install it in your Dockerfile.

Daemon socket timeouts require positive values

PSPDFKITD_READ_TIMEOUT and PSPDFKITD_WRITE_TIMEOUT now require positive integer values in milliseconds. Values of 0 and infinity, which were previously accepted but ignored, now prevent Document Engine from starting.

Before upgrading, replace these values with a positive timeout or unset the variables to use the defaults: 120000 milliseconds for reads and 10000 milliseconds for writes.

Prometheus durations use the unit in their name

These Prometheus summaries now report values in the unit their name ends with. Before, their values were a million times too small:

  • http_server_request_duration_microseconds (values were in seconds)
  • gdpicture_queue_duration_milliseconds
  • gdpicture_queue_drop_duration_milliseconds
  • gdpicture_exec_duration_milliseconds
  • async_jobs_queue_duration_milliseconds
  • async_jobs_execution_duration_milliseconds
  • layer_sync_duration_milliseconds
  • first_page_prerendering_duration_milliseconds

After upgrading, dashboards and alerts on these metrics see values a million times larger. If you multiplied them to make up for the old values, remove that.

Permission-aware long polling covers pending changes

If you already have INSTANT_PERMISSION_AWARE_LONG_POLL=true set, upgrading changes how quickly a viewer hides an annotation after a group change revokes access. Previously, if the revocation was pending when the next long poll started, Document Engine returned it immediately.

After upgrading, if all pending changes are hidden from the user, the poll can stay open until the next visible change or the request timeout. An annotation already onscreen can remain visible during that wait. Deleting a record that could still be visible wakes the poll immediately. Deleting a known hidden placeholder can wait until the next response.

Before upgrading, set INSTANT_PERMISSION_AWARE_LONG_POLL=false (the default) if your integration relies on the next poll to deliver a pending revocation immediately. See fewer synchronization responses for hidden changes.

Deprecations

This release doesn’t include any deprecations.

Per-part conversion options on a shared Build API input

Several file parts of a Build API request could reference the same input, and one of them could set no conversion options. In that case, Document Engine converted the input once with the default options and reused the result for every part. A part’s own conversion options were then ignored. For example, a part with "markup_mode": "allMarkup" showed no comments when another part used the same Word document with the default DOCX_MARKUP_MODE of noMarkup.

Each file part that sets any of these options is now converted with its own options, even when other parts use the same input:

  • markup_mode
  • layout
  • email_language
  • email_timezone
  • half_transparent_header_footer
  • render_only_print_area

The input is still uploaded or downloaded only once per request. Parts without these options keep sharing a single conversion, so a request that mixes both kinds of parts for one input now runs one extra conversion for each part that sets options.

When a part’s own conversion times out or DocProcessor is out of capacity, the request now fails with HTTP 408 or 500, the same as when the shared conversion fails this way. Before, it failed with HTTP 400, as if the instructions were wrong.

Cleanup reports progress when it times out

When POST /api/cleanup reaches SERVER_REQUEST_TIMEOUT, it now returns HTTP 408 with counts of assets removed and retained before the timeout. Completed removals remain in effect; the request is safe to repeat, but if repeated requests remove nothing, increase SERVER_REQUEST_TIMEOUT.

Recovery from temporary database overload

Document Engine now retries server synchronization registration and online-state updates when database queries fail. Two periodic tasks, node cleanup and asynchronous job queue metrics reporting, now log database errors and run again at their next interval. As a result, the node can recover after temporary database overload without a restart.

Prerendered tiles for current Nutrient Web SDK viewers

Nutrient Web SDK 1.21.0 and later request tiles with overprint preview by default, but Document Engine prerendered tiles without it, so these viewers didn’t get the prerendered tiles. First-page prerendering now uses the options of the Web SDK version that opens the document, and the prerender API uses those of current Web SDK versions by default.

If your viewers set overprintPreview to off or use a Web SDK version earlier than 1.21.0, pass "overprint_preview": "off" to POST /api/documents/{documentId}/prerender. Viewers on Web SDK 1.21.0 through 1.25.x that set overprintPreview to off or use pure black rendering don’t get the first-page prerendered tiles.

From Nutrient Web SDK 1.26.0, viewers send their overprintPreview and blackRendering settings when they open a document, and first-page prerendering uses them.

A new Prometheus metric counts the first-page tile requests:

  • first_page_tile_requests_total{result="hit|miss",overprint="on|off"} — How many first-page tile requests Document Engine served from the tile cache (hit) or had to render (miss), and whether they asked for overprint preview.

A hit doesn’t show that prerendering cached the tile: A tile rendered for an earlier request counts too. Requests that arrive before prerendering finishes count as misses. Compare the share of hits over time rather than reading it as the prerendering’s hit rate.

HTML rendering options

HTML parts in POST /api/build accept a new rendering object that controls how the HTML is loaded and printed:

  • waitForSelector holds printing until a CSS selector matches. Use it for content that renders after the load event, such as charts. Have the page’s script add a marker when it’s done, such as data-pdf-ready="true" on the body, and wait for that marker. waitTimeout limits the wait, and waitDelay adds a fixed pause. If the selector is invalid or doesn’t match in time, the request fails with a 400 error instead of returning an incomplete PDF.
  • emulatedMediaType set to print applies @media print rules. Pages still render with screen media by default.
  • preferCssPageSize gives a CSS @page { size: ... } declaration precedence over layout.size.
  • generateDocumentOutline turns the headings in the HTML into PDF bookmarks.
  • scale scales the rendered page content.
{
"parts": [
{
"html": "index.html",
"rendering": {
"waitForSelector": "[data-pdf-ready=\"true\"]",
"emulatedMediaType": "print",
"generateDocumentOutline": true
}
}
]
}

Running headers, footers, and page numbers can also be set with CSS @page margin boxes:

@page {
@bottom-right {
content: "Page " counter(page) " of " counter(pages);
}
}

Margin boxes render in a single pass and keep the document outline, links, and tags. The document outline isn’t kept when the HTML uses the pspdfkit-header or pspdfkit-footer elements, and scale and preferCssPageSize can’t be combined with those elements.

Requests without a rendering object render as before.

HTML rendering errors

An HTML part used to produce a PDF even when an image returned 404, a stylesheet was blocked, or a script threw, leaving the PDF without that content. Two new options of the HTML part’s rendering object make those problems fail the request instead:

  • failOnResourceError fails the request when a resource the page loads responds with an HTTP status of 400 or above, fails to load, or is blocked. A resource can be blocked, for example, because remote assets are disabled.
  • failOnConsoleError fails the request when a script throws an uncaught exception or calls console.error.

The request fails with a 400 error, and failingPaths lists each resource URL with its reason, or each error message. At most 20 errors are listed, so a page with more can fail again after you fix those:

{
"parts": [
{
"html": "index.html",
"assets": ["logo.png"],
"rendering": {
"failOnResourceError": true,
"failOnConsoleError": true
}
}
]
}

Both options are off by default, so requests that don’t set them render as before.

Relative assets of HTML downloaded from a URL

Build API HTML parts can reference the HTML with a URL ("html": {"url": "…"}). Relative URLs in that HTML (stylesheets, images, fonts, and scripts) used to resolve against the temporary directory Document Engine renders the HTML from, so they didn’t load. Links with relative URLs pointed to that directory in the generated PDF.

Relative URLs now resolve against the URL the HTML was downloaded from, after redirects, like they do in a browser. A <base> element in the HTML is respected, and in-page links such as #section still link to destinations in the generated PDF. Pages that use relative assets now render with them, so their layout and page count can change.

This applies when:

  • remote assets in HTML-to-PDF generation are allowed (ALLOW_REMOTE_ASSETS_IN_GENERATION, enabled by default), and
  • the HTML part has no assets. When a part uploads assets, relative URLs keep referring to those assets.

Resolved assets are loaded like absolute remote assets. Assets on loopback, private, and link-local addresses are never loaded, and credentials in the HTML URL aren’t sent with asset requests.

Fonts are the exception. The HTML is rendered from a local file, so a font only loads if its server allows cross-origin requests from any origin (Access-Control-Allow-Origin: *). This applies even when the font is on the same site as the HTML. Otherwise, the text uses a fallback font.

Because these pages now load assets from the network, a server that doesn’t respond could make the request time out. Instead, assets that are still loading 15 seconds after the HTML starts loading are left out as if they were unavailable, and the PDF is generated without them. This applies to all of the page’s assets, including absolute URLs.

Faster Instant synchronization for shared documents

Instant now reduces load times and memory use when opening shared documents with many records that the user can’t view. The optimization also applies when synchronizing changes from older revisions.

This optimization is enabled by default. Set INSTANT_SKIP_INVISIBLE_RECORD_CONTENT=false to disable it. No database migration or SDK update is required. Collaboration permissions, revision tracking, and the data returned to viewers stay unchanged.

Sessions that can view every record don’t benefit from this optimization. Synchronization response sizes and shared collaboration notifications stay unchanged.

PDF workers return after a period of overload

Document Engine reads the annotations and comments of a document from a PDF worker in batches. If a request ended before it read all batches — for example, because it got no database connection — the worker stayed reserved for that request. After enough such requests, no worker was left, and all requests that need a worker failed until the node restarted.

A worker now becomes available again when the request process that uses it ends, including when it exits normally. A live request retains its worker while processing between batches.

When no PDF worker is free for the validation of a PDF, uploads and Build API requests now return HTTP 503 in place of HTTP 500.

Fewer synchronization responses for hidden changes

With INSTANT_PERMISSION_AWARE_LONG_POLL=true, Instant long-poll requests now keep waiting when the changes already available at the start of a request are all hidden from the user. This reduces unnecessary synchronization responses and the early uploads of pending edits that those responses can cause.

Hidden changes are delivered with the next visible change or when the original request timeout expires. The same behavior applies after refetching changes because the pending batch reached its record limit or a notification had a revision gap. A deletion can also wait if the viewer previously received only a hidden placeholder. The next response includes the deleted record’s ID. If the record could still be visible, its deletion wakes the viewer immediately. No client changes are required.

Group changes that revoke visibility can now also be delayed when they’re already available at the start of a request. Until delivery, the client can continue to show the record. Don’t enable this option if these changes must promptly remove records from connected clients’ views.

Default file of a PDF Portfolio

The embedded files endpoints now return defaultEmbeddedFileId next to embeddedFiles. It’s the id of the file a PDF Portfolio names as the one to open first, and null when the document doesn’t name one. PDF viewers such as Adobe Acrobat show that file instead of the portfolio’s cover page. Nutrient Web SDK returns it from Instance#getDefaultEmbeddedFile().

Documents uploaded before this release get the value the first time they’re opened. Document Engine reads it from the stored PDF once per document, and only for documents that have embedded files. No database migration is required.

Remote URL fetching security

Document Engine now applies its remote URL fetch policy to IPv4 addresses embedded in well-known NAT64 addresses (64:ff9b::/96). Public IPv4 destinations remain available through NAT64. Private and special-purpose destinations follow the IPv4 policy, but translated loopback can’t use the native loopback allowlist exception.

CIDR allowlists can match either the embedded IPv4 or translated IPv6 address. Allowlisting the entire NAT64 prefix permits all non-critical embedded IPv4 ranges; prefer narrow CIDRs. Critical destinations remain blocked.

Remote URL fetching and HTML-to-PDF generation now reject additional AWS IPv6 service, transition, benchmarking, IETF protocol-assignment, and relay ranges. Local-use NAT64 (64:ff9b:1::/48) is blocked under every policy except allow_all: The address alone doesn’t identify its translation layout, so Document Engine can’t reliably check the embedded IPv4 destination. Deployments using this allocation must change their fetch destination or translation setup.

IPv4 and IPv6 benchmarking ranges remain available under allow_private. The IETF protocol-assignment (192.0.0.0/24, including PCP/TURN anycast) and IPv4 relay (192.88.99.0/24) ranges require an explicit host or CIDR allowlist.

Markup mode for macro-enabled Word documents and templates

The markup_mode option of Build API file parts and the DOCX_MARKUP_MODE configuration option are now documented for every Office Open XML Word document: DOCX, DOCM (macro-enabled), DOTX (template), and DOTM (macro-enabled template). Document Engine converts uploaded DOCM, DOTX, and DOTM files as DOCX, so these options already applied to them. Document Engine now also applies them when one of these documents is identified by its own media type.

Requests that set markup_mode for DOC, RTF, ODT, or plain text inputs are still rejected with a 400 response. The error message now names the supported formats.

Clearer error for password-protected Office documents

Document Engine doesn’t support password-protected Office documents yet. Build API requests that include a password-protected DOCX, XLSX, PPTX, or another Office Open XML document now fail with a 400 response. The response says the document is password-protected. Before, it reported an unsupported application/encrypted file type. The password option of file parts applies only to PDF inputs. Remove the password from the Office document before converting it.

Database migrations

This release changes the type of font_substitutions.layer_id from integer to bigint to match layers.id. Before this change, layer IDs greater than 2,147,483,647 caused errors when Document Engine generated a PDF with annotations.

The migration rewrites the font_substitutions table and its indexes. This table contains only font substitutions that were set for a document layer through the API. Font substitutions from the font-substitutions.json file aren’t stored in this table. During the rewrite, the table is locked, and PDF generation waits for the lock. The rewrite takes approximately one second for each million rows on fast storage.

The migration waits a maximum of five seconds for the lock. If it can’t get the lock in that time, the migration fails, and the Document Engine node that runs the migrations stops. Start the node again to retry the migration.

If the table has more than one million rows, the migration doesn’t change the column, and it logs a warning. While the column is integer, each Document Engine node also logs a warning when it starts, and the dashboard shows the warning. PDF generation works with the old column type. But you can’t set font substitutions for layer IDs greater than 2,147,483,647 until you change the column. To change the column, run this statement in a maintenance window:

ALTER TABLE font_substitutions ALTER COLUMN layer_id TYPE bigint;

Then restart each Document Engine node. Each node checks the column type only when it starts, so the warning stays until the node restarts.

To find the number of rows before you upgrade, run this query:

SELECT count(*) FROM font_substitutions;

If you already changed the column to bigint manually, the migration does nothing.

This release adds a layer_pdf_assets table. When a layer stores its own PDF, Document Engine adds a row for that PDF to this table. When you delete the document, Document Engine uses these rows to find the layer PDFs to delete. Earlier versions kept this list in the source_pdf column of the document and copied the list into the source_pdf column of each layer. The size of that data increased with the square of the number of layers. Also, concurrent layer saves on one document could lose entries from the list.

The migration creates:

  • layer_pdf_assets
  • layer_pdf_assets_asset_uuid_index

The table is new and empty, so the migration is fast. It has no foreign key, so it doesn’t lock other tables.

The migration doesn’t change existing documents or layers rows. When you delete a document, Document Engine still uses the list in the source_pdf column of the document. A layer removes its copy of the list the next time it stores a new PDF.

Document Engine nodes that run an earlier version don’t use the new table. If such a node deletes a document during a rolling upgrade or after a rollback, some layer PDFs can stay in storage, and the rows of that document can stay in layer_pdf_assets. To delete these PDFs, call POST /api/cleanup. The rows that stay have no effect.

This release also adds a nullable deletion_metadata column to the records table, used by permission-aware long polling. The migration doesn’t rewrite the table.