PDFsharp & MigraDoc Foundation

Setting Check Box Value
Page 1 of 1

Author:  tomdsharp [ Wed Aug 18, 2021 1:31 pm ]
Post subject:  Setting Check Box Value

I believe that there is an issue with setting the checkbox value vs setting the checkbox checked property.

I was setting the value of a checkbox like this:
pChk.Value = New PdfSharp.Pdf.PdfName(pChk.CheckedName)

This action appeared to work correctly and also changed the checked property of the checkbox correctly to true or false as expected.
The resulting saved pdf file displays correctly in Adobe or Acrobat reader.
However, there is something not correct in the pdf file, because Adobe changes something and wants to save it after viewing it.

We then noticed that the checkbox does not display as checked when the saved pdf is viewed in Chrome and some other viewers.
The saved pdf displays property in all viewers if the checkbox is set by using the checked property instead like this:
pChk.Checked = True

It seems that there is some extra internal value that is set when using the checked property verses the value property.
I would expect both actions to produce exactly the same result.

Thank you. I appreciate the PDFSharp library.

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