parallax/jsPDF · error · Error

Invalid value "{value}" for attribute Ff supplied.

Error message

Invalid value "{value}" for attribute Ff supplied.

What it means

Thrown by the AcroFormField.Ff setter when the assigned value is NaN. Ff is the field-specific Flags entry (PDF spec Table 88) controlling behavior per field type (read-only, required, multiline, etc.). It must be an integer bitmask; default 0. The setter uses the same isNaN guard as F.

Source

Thrown at src/modules/acroform.js:1071

        this.F = setBitForPdf(_F, 3);
      } else {
        this.F = clearBitForPdf(_F, 3);
      }
    }
  });

  var _Ff = 0;
  Object.defineProperty(this, "Ff", {
    enumerable: false,
    configurable: false,
    get: function() {
      return _Ff;
    },
    set: function(value) {
      if (!isNaN(value)) {
        _Ff = value;
      } else {
        throw new Error(
          'Invalid value "' + value + '" for attribute Ff supplied.'
        );
      }
    }
  });

  var _Rect = [];
  Object.defineProperty(this, "Rect", {
    enumerable: false,
    configurable: false,
    get: function() {
      if (_Rect.length === 0) {
        return undefined;
      }
      return _Rect;
    },
    set: function(value) {
      if (typeof value !== "undefined") {

View on GitHub (pinned to a3930ce03a)

Solutions

  1. Assign only integer bitmasks to Ff, or use the high-level boolean properties (readOnly, required, multiline, etc.) that call setBitForPdf/clearBitForPdf correctly.
  2. Coerce and validate the value is a finite number before assignment.
  3. Initialize Ff to 0 and only set bits through documented properties.

Example fix

// before
field.Ff = 'multiline'; // throws

// after
field.multiline = true; // uses setBitForPdf under the hood
// or
field.Ff = jsPDF.API.__acroform__.setBitForPdf(field.Ff, 13); // bit 13 = Multiline (1-based)
Defensive patterns

Strategy: validation

Validate before calling

function setFf(field, value) {
  var n = Number(value);
  if (!isFinite(n)) throw new Error('Ff must be a numeric bitmask, got ' + value);
  field.Ff = n;
}

Type guard

function isNumericFlag(v) {
  return typeof v === 'number' && isFinite(v);
}

Try / catch

try {
  field.Ff = value;
} catch (e) {
  if (/attribute Ff supplied/.test(e.message)) {
    field.Ff = Number(value) || 0;
  } else throw e;
}

Prevention

When it happens

Trigger: Assigning field.Ff = 'required' or another non-numeric string; assigning NaN/object; or a computed flag that became NaN.

Common situations: Setting field behavior flags with human-readable strings instead of bitmasks; a failed bit operation producing NaN that is then assigned.

Related errors


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