parallax/jsPDF · error · Error

The filter: "${filterChain[i]}" is not implemented

Error message

The filter: "${filterChain[i]}" is not implemented

What it means

processDataByFilters(data, filterChain) walks the filter chain and only recognizes ASCII85Encode/Decode, ASCIIHexEncode/Decode, and FlateEncode (each with optional leading '/'). Any other filter name hits the switch default and throws 'not implemented'. The filter name in the message is the offending token.

Source

Thrown at src/modules/filters.js:188

          reverseChain.push("/ASCII85Decode");
          break;
        case "ASCIIHexDecode":
        case "/ASCIIHexDecode":
          data = ASCIIHexDecode(data);
          reverseChain.push("/ASCIIHexEncode");
          break;
        case "ASCIIHexEncode":
        case "/ASCIIHexEncode":
          data = ASCIIHexEncode(data);
          reverseChain.push("/ASCIIHexDecode");
          break;
        case "FlateEncode":
        case "/FlateEncode":
          data = FlateEncode(data);
          reverseChain.push("/FlateDecode");
          break;
        default:
          throw new Error(
            'The filter: "' + filterChain[i] + '" is not implemented'
          );
      }
    }

    return { data: data, reverseChain: reverseChain.reverse().join(" ") };
  };
})(jsPDF.API);

View on GitHub (pinned to a3930ce03a)

Solutions

  1. Use only the implemented names: ASCII85Encode/Decode, ASCIIHexEncode/Decode, FlateEncode (optionally with a leading '/').
  2. For decompression (FlateDecode) use an external library (pako/zlib) and feed the result back to jsPDF.
  3. Check filter name case and the optional leading slash against the switch cases.

Example fix

// before
const out = jsPDF.API.processDataByFilters(stream, 'FlateDecode'); // throws [116]

// after: decode with pako, then re-encode with jsPDF if needed
import { inflate } from 'pako';
const decoded = inflate(stream);
const reencoded = jsPDF.API.processDataByFilters(decoded, 'FlateEncode');
Defensive patterns

Strategy: validation

Validate before calling

const IMPLEMENTED_FILTERS = new Set([
  'ASCII85Encode', '/ASCII85Encode',
  'ASCII85Decode', '/ASCII85Decode',
  'ASCIIHexEncode', '/ASCIIHexEncode',
  'ASCIIHexDecode', '/ASCIIHexDecode',
  'FlateEncode', '/FlateEncode'
]);
function safeProcessByFilters(data, chain) {
  const list = Array.isArray(chain) ? chain : [chain];
  if (!list.every(f => IMPLEMENTED_FILTERS.has(f))) {
    throw new Error('Unsupported filter requested: ' + list.filter(f => !IMPLEMENTED_FILTERS.has(f)).join(','));
  }
  return jsPDF.API.processDataByFilters(data, list);
}

Type guard

function isImplementedFilter(name) {
  return IMPLEMENTED_FILTERS.has(name);
}

Try / catch

try {
  out = jsPDF.API.processDataByFilters(data, filter);
} catch (e) {
  if (/is not implemented/.test(e.message)) {
    // route to an external decoder (pako for FlateDecode) and skip jsPDF's filter
  } else throw e;
}

Prevention

When it happens

Trigger: Calling jsPDF.API.processDataByFilters(data, 'FlateDecode') — note only FlateENCODE is implemented, FlateDecode is not; passing 'DCTDecode', 'RunLengthDecode', 'CCITTFaxDecode', 'LZWDecode', or any other PDF filter; typos like 'flateencode' (case-sensitive) or missing '/' prefix variants.

Common situations: Trying to DEFLATE-decompress an embedded stream (FlateDecode unsupported); mixing up Encode/Decode directions; copying filter names from PDF specs that jsPDF never implemented.

Related errors


AI-assisted analysis of parallax/jsPDF@a3930ce03a (2026-08-13). Data as JSON: /api/errors/77f9e051cef9d6b7. Report an issue: GitHub.