@@ -212,6 +212,32 @@ public void checkBoxToggleTest02() throws IOException, InterruptedException {
212212 Assert .fail (errorMessage );
213213 }
214214 }
215+
216+ @ Test
217+ public void keepCheckTypeTest () throws IOException , InterruptedException {
218+ String srcPdf = destinationFolder + "keepCheckTypeTestInput.pdf" ;
219+ String outPdf = destinationFolder + "keepCheckTypeTest.pdf" ;
220+ String cmpPdf = sourceFolder + "cmp_keepCheckTypeTest.pdf" ;
221+
222+ try (PdfDocument pdfDoc = new PdfDocument (new PdfWriter (srcPdf ))) {
223+ PdfAcroForm form = PdfAcroForm .getAcroForm (pdfDoc , true );
224+
225+ PdfButtonFormField checkField = new CheckBoxFormFieldBuilder (pdfDoc , "checkField" )
226+ .setWidgetRectangle (new Rectangle (100 , 600 , 100 , 100 ))
227+ .setCheckType (CheckBoxType .CHECK ).createCheckBox ();
228+ checkField .setValue ("Off" );
229+
230+ checkField .setFontSizeAutoScale ();
231+ form .addField (checkField );
232+ }
233+
234+ try (PdfDocument pdfDoc = new PdfDocument (new PdfReader (srcPdf ), new PdfWriter (outPdf ))) {
235+ PdfAcroForm form = PdfAcroForm .getAcroForm (pdfDoc , true );
236+ form .getField ("checkField" ).setValue ("Yes" , false );
237+ }
238+
239+ Assert .assertNull (new CompareTool ().compareByContent (outPdf , cmpPdf , destinationFolder , "diff_" ));
240+ }
215241
216242 @ Test
217243 public void appearanceRegenerationTest () throws IOException , InterruptedException {
0 commit comments