parallax/jsPDF · error · Error
Invalid value "{value}" for attribute F supplied.
Error message
Invalid value "{value}" for attribute F supplied. What it means
Thrown by the AcroFormField.F setter when the assigned value is NaN. F is the annotation Flags entry (PDF spec Table 165) and must be an integer bitmask; the setter guards with isNaN. The default is 4 (Print). Note: isNaN(undefined) is false and isNaN('') is false, so empty string/undefined sneak through, but true non-numeric strings throw.
Source
Thrown at src/modules/acroform.js:1030
* @class AcroFormField
* @classdesc An AcroForm FieldObject
*/
var AcroFormField = function() {
AcroFormPDFObject.call(this);
//Annotation-Flag See Table 165
var _F = 4;
Object.defineProperty(this, "F", {
enumerable: false,
configurable: false,
get: function() {
return _F;
},
set: function(value) {
if (!isNaN(value)) {
_F = value;
} else {
throw new Error(
'Invalid value "' + value + '" for attribute F supplied.'
);
}
}
});
/**
* (PDF 1.2) If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of wether is is displayed on the screen.
* NOTE 2 This can be useful for annotations representing interactive pushbuttons, which would serve no meaningful purpose on the printed page.
*
* @name AcroFormField#showWhenPrinted
* @default true
* @type {boolean}
*/
Object.defineProperty(this, "showWhenPrinted", {
enumerable: true,
configurable: true,
get: function() {View on GitHub (pinned to a3930ce03a)
Solutions
- Assign only integer bitmasks to F, or use the boolean helpers (showWhenPrinted) which manipulate bits correctly.
- Coerce with Number() and validate isFinite before assignment.
- Leave F at its default unless you specifically need a non-default annotation flag.
Example fix
// before field.F = 'printable'; // throws // after field.F = 4; // bit 3 = Print // or use the helper field.showWhenPrinted = true;
Defensive patterns
Strategy: validation
Validate before calling
function setF(field, value) {
var n = Number(value);
if (!isFinite(n)) throw new Error('F must be a numeric bitmask, got ' + value);
field.F = n;
} Type guard
function isNumericFlag(v) {
return typeof v === 'number' && isFinite(v);
} Try / catch
try {
field.F = value;
} catch (e) {
if (/attribute F supplied/.test(e.message)) {
field.F = Number(value) || 4;
} else throw e;
} Prevention
- Assign integer bitmasks to F, or use the boolean helpers like showWhenPrinted.
- Validate flag values are finite numbers before assignment.
- Leave F at its default (4) unless you need a specific annotation flag.
When it happens
Trigger: Assigning field.F = 'abc' or field.F = NaN, or assigning an object; indirectly, a computed flag value that became NaN.
Common situations: Trying to set the print/annotation flag with a descriptive string instead of a bitmask; chaining bit operations that yielded NaN.
Related errors
- Invalid value "{value}" for attribute Ff supplied.
- Invalid value "{value}" for attribute FT supplied.
- Invalid arguments passed to jsPDF.API.__acroform__.setBit
- Invalid arguments passed to jsPDF.API.__acroform__.clearBit
- Invalid arguments passed to jsPDF.API.__acroform__.getBit
AI-assisted analysis of parallax/jsPDF@a3930ce03a (2026-08-13).
Data as JSON: /api/errors/f99b61fb9bb7aea1.
Report an issue: GitHub.