mozilla/pdf.js · error · Error

No ICC color space support

Error message

No ICC color space support

What it means

Thrown by the IccColorSpace constructor when IccColorSpace.isUsable is false. isUsable returns false when wasm-based QCMS support is disabled (useWasm=false, useWorkerFetch=false) or when the qcms_bg.wasm module fails to load from the configured wasmUrl. ICC color space conversion is entirely wasm-backed, so without it the constructor refuses to create an instance.

Source

Thrown at src/core/icc_colorspace.js:55

  xhr.responseType = "arraybuffer";
  xhr.send(null);
  return xhr.response;
}

class IccColorSpace extends ColorSpace {
  #transformer;

  #convertPixel;

  static #useWasm = true;

  static #wasmUrl = null;

  static #finalizer = null;

  constructor(iccProfile, name, numComps) {
    if (!IccColorSpace.isUsable) {
      throw new Error("No ICC color space support");
    }

    super(name, numComps);

    let inType;
    switch (numComps) {
      case 1:
        inType = DataType.Gray8;
        this.#convertPixel = (src, srcOffset) =>
          qcms_convert_one(this.#transformer, src[srcOffset] * 255);
        break;
      case 3:
        inType = DataType.RGB8;
        this.#convertPixel = (src, srcOffset) =>
          qcms_convert_three(
            this.#transformer,
            src[srcOffset] * 255,
            src[srcOffset + 1] * 255,

View on GitHub (pinned to 5903d58d58)

Solutions

  1. Call getDocument with { useWorkerFetch:true, wasmUrl:'<url-to-qcms-dir>/', isEvalSupported:true } so the worker can fetch qcms_bg.wasm.
  2. Ensure wasmUrl points to the directory containing qcms_bg.wasm (trailing slash) from pdfjs-dist's cmaps/standard asset location.
  3. If your environment cannot use wasm, pre-convert ICC-based PDFs to sRGB before rendering.
  4. Verify CSP allows worker-src and the wasm destination, and that the server serves .wasm with application/wasm.

Example fix

// before
getDocument({ url });

// after
getDocument({
  url,
  useWorkerFetch: true,
  wasmUrl: '/pdfjs-dist/web/',  // directory containing qcms_bg.wasm
});
Defensive patterns

Strategy: validation

Validate before calling

// Validate API options before loading the document.
function iccOptionsAreUsable(opts) {
  return !!(opts && opts.useWorkerFetch && opts.wasmUrl);
}
// Usage:
// if (!iccOptionsAreUsable({ useWorkerFetch, wasmUrl })) console.warn('ICC will be unavailable');

Type guard

function hasIccWasmConfig(opts) {
  return opts != null &&
    typeof opts.useWorkerFetch === 'boolean' && opts.useWorkerFetch === true &&
    typeof opts.wasmUrl === 'string' && opts.wasmUrl.length > 0;
}

Try / catch

try {
  await getDocument({ url, useWorkerFetch: true, wasmUrl }).promise;
} catch (err) {
  if (err?.message === 'No ICC color space support') {
    console.warn('ICC disabled; provide useWorkerFetch + wasmUrl for ICC PDFs.');
  } else throw err;
}

Prevention

When it happens

Trigger: Constructing an ICCBased color space while (a) getDocument was called without useWorkerFetch:true, (b) wasmUrl was not provided, (c) the synchronous XHR for qcms_bg.wasm failed, or (d) useWasm:false was set via IccColorSpace.setOptions. Triggered by any PDF using an ICCBased color space under those conditions.

Common situations: Default deployments that omit the new wasm/iccUrl API options introduced for ICC support; CSP that blocks the wasm fetch; misconfigured worker URL; environments without SharedArrayBuffer/fetch where the sync XHR cannot retrieve the module.

Related errors


AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13). Data as JSON: /api/errors/88c01a52866fca83. Report an issue: GitHub.