PDFsharp & MigraDoc Foundation

Not able to update checkbox value for PDFCheckBoxField
Page 1 of 1

Author:  joshihrn1990 [ Wed Mar 30, 2022 11:52 pm ]
Post subject:  Not able to update checkbox value for PDFCheckBoxField

Hello Team,

I am using PDFSharpCore 1.3.9 library. I have PDF form with form fields as textbox and checkbox. I am updating values for these fields using library. Once I update values and open PDF in Adobe reader, I am able to see textboxes updated with values and checkboxes checked accordingly but if I open same PDF in any browser then I am only able to see textbox values and checkbox is not showing up as checked.

I created copy of same PDF file. Opened it in Adobe, and clicked on Save. After doing this, I am able to see both textbox values and checkbox as checked in any browser.

Looking into that more, I realized there is one element that is missing for PdfCheckBoxField that is '/AP' but I am using below code to add appearance.

if (acroForm.Elements.ContainsKey("/NeedAppearances"))
acroForm.Elements["/NeedAppearances"] = new PdfBoolean(true);
acroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));

Am I missing something here?

Thank you for your help!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group