You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to set fields as read only not to allow users chage it. field.enableReadOnly(). For PDFTextField fields it works fine, but for PDFCheckBox-es it does not work.
What were you trying to do?
I am trying to set fields as read only not to allow users chage it. field.enableReadOnly(). For PDFTextField fields it works fine, but for PDFCheckBox-es it does not work.
How did you attempt to do it?
const form = pdfDoc.getForm();
const fields = form.getFields();
fields.forEach((f) => f.enableReadOnly());
What actually happened?
For PDFTextField fields it works fine, but for PDFCheckBox-es it does not work.
What did you expect to happen?
I expect that user can't change checkboxes value but user can check and uncheck each checkbox
How can we reproduce the issue?
async fillFormFields(formData: Record<string, string | string[]>) {
const filePath = path.join(__dirname, 'templates', 'CMS1500.pdf');
const pdfBuffer = fs.readFileSync(filePath);
const pdfDoc = await PDFDocument.load(pdfBuffer);
const form = pdfDoc.getForm();
const fields = form.getFields();
// Apply permissions to make the document read-only
CMS1500(6).pdf
}
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: