/var/www/greso.tech/server/nsm/node_modules/pdf-lib/src/core/acroform
NameSizeModeActions
flags.ts58260644editdlrm
index.ts11080644editdlrm
PDFAcroButton.ts32420644editdlrm
PDFAcroCheckBox.ts14400644editdlrm
PDFAcroChoice.ts45540644editdlrm
PDFAcroComboBox.ts6680644editdlrm
PDFAcroField.ts48390644editdlrm
PDFAcroForm.ts27420644editdlrm
PDFAcroListBox.ts5720644editdlrm
PDFAcroNonTerminal.ts8890644editdlrm
PDFAcroPushButton.ts6820644editdlrm
PDFAcroRadioButton.ts17110644editdlrm
PDFAcroSignature.ts3340644editdlrm
PDFAcroTerminal.ts21930644editdlrm
PDFAcroText.ts21460644editdlrm
utils.ts54520644editdlrm
Edit: /var/www/greso.tech/server/nsm/node_modules/pdf-lib/src/core/acroform/PDFAcroCheckBox.ts (1440B)
import PDFContext from 'src/core/PDFContext'; import PDFRef from 'src/core/objects/PDFRef'; import PDFDict from 'src/core/objects/PDFDict'; import PDFName from 'src/core/objects/PDFName'; import PDFAcroButton from 'src/core/acroform/PDFAcroButton'; import { InvalidAcroFieldValueError } from 'src/core/errors'; class PDFAcroCheckBox extends PDFAcroButton { static fromDict = (dict: PDFDict, ref: PDFRef) => new PDFAcroCheckBox(dict, ref); static create = (context: PDFContext) => { const dict = context.obj({ FT: 'Btn', Kids: [], }); const ref = context.register(dict); return new PDFAcroCheckBox(dict, ref); }; setValue(value: PDFName) { const onValue = this.getOnValue() ?? PDFName.of('Yes'); if (value !== onValue && value !== PDFName.of('Off')) { throw new InvalidAcroFieldValueError(); } this.dict.set(PDFName.of('V'), value); const widgets = this.getWidgets(); for (let idx = 0, len = widgets.length; idx < len; idx++) { const widget = widgets[idx]; const state = widget.getOnValue() === value ? value : PDFName.of('Off'); widget.setAppearanceState(state); } } getValue(): PDFName { const v = this.V(); if (v instanceof PDFName) return v; return PDFName.of('Off'); } getOnValue(): PDFName | undefined { const [widget] = this.getWidgets(); return widget?.getOnValue(); } } export default PDFAcroCheckBox;