Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iTextSharp 5.5.6 enters a cross symbol when Check Type Style is Check Mark

Tags:

c#

itextsharp

This question was asked previously (iTextSharp 5.5.6.0 Bug? check box tick mark changes) but with no answer supplied, I cannot comment because I am a new user. I am having exactly the same issue.

I have an existing PDF that I am filling in programmatically (C#).

There are check boxes on the form. In build 4.4.x they rendered a check mark when selected. In build 5.5.5.0 and 5.5.6.0 they are now a cross symbol.

Don't think setting the property would have any effect as already set to this in the pdf. How can I get a check mark instead of the cross.

I am using the latest version as available from NuGet. May have to go back to an earlier version if cannot resolve this issue.

like image 662
Stuart Brant Avatar asked Dec 15 '22 09:12

Stuart Brant


1 Answers

I was having a similar issue with iTextSharp 5.5.9 after upgrading from a 4.x version. While setting checkboxes the appearance would not be the same as it was set in the original pdf (which was created in acrobat). After excessive digging (the reference materials are difficult to use =/) I finally found an overload for the function AcroFields.setField() that takes a boolean parameter 'saveAppearance'. Passing 'true' preserves the appearance set in the original pdf.

I was able to dig up this information here

like image 81
Zachary Avatar answered Dec 17 '22 01:12

Zachary