mozilla/pdf.js · error · FormatError
Unsupported predictor: ${predictor}
Error message
Unsupported predictor: ${predictor} What it means
Error "Unsupported predictor: ${predictor}" thrown in mozilla/pdf.js.
Source
Thrown at src/core/predictor_stream.js:33
import { DecodeStream } from "./decode_stream.js";
import { Dict } from "./primitives.js";
import { FormatError } from "../shared/util.js";
class PredictorStream extends DecodeStream {
constructor(str, maybeLength, params) {
super(maybeLength);
if (!(params instanceof Dict)) {
return str; // no prediction
}
const predictor = (this.predictor = params.get("Predictor") || 1);
if (predictor <= 1) {
return str; // no prediction
}
if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
throw new FormatError(`Unsupported predictor: ${predictor}`);
}
this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
this.stream = str;
this.dict = str.dict;
const colors = (this.colors = params.get("Colors") || 1);
const bits = (this.bits = params.get("BPC", "BitsPerComponent") || 8);
const columns = (this.columns = params.get("Columns") || 1);
this.pixBytes = (colors * bits + 7) >> 3;
this.rowBytes = (columns * colors * bits + 7) >> 3;
return this;
}
readBlockTiff() {View on GitHub (pinned to 5903d58d58)
Solutions
- Set the stream's /Predictor value to a supported predictor (1, 2, or 10-15); other predictor values are not supported.
- If the predictor is valid but the PDF is non-conforming, regenerate the stream with a standard PNG/TIFF predictor value.
When it happens
Trigger: Thrown at src/core/predictor_stream.js:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/f51c94cf32d6b74d.
Report an issue: GitHub.