@@ -149,7 +149,7 @@ public void pdfAButtonFieldTest() throws Exception {
149
149
150
150
pdf .close ();
151
151
Assert .assertNull (
152
- new CompareTool ().compareByContent (filename , sourceFolder + "cmp_" + file , destinationFolder , "diff_" ));
152
+ new CompareTool ().compareByContent (filename , sourceFolder + "cmp/PdfAFormFieldTest/ cmp_" + file , destinationFolder , "diff_" ));
153
153
}
154
154
155
155
static class PdfAButtonFieldTestRenderer extends ParagraphRenderer {
@@ -199,7 +199,7 @@ public void draw(DrawContext context) {
199
199
public void pdfA1DocWithPdfA1ButtonFieldTest () throws IOException , InterruptedException {
200
200
String name = "pdfA1DocWithPdfA1ButtonField" ;
201
201
String fileName = destinationFolder + name + ".pdf" ;
202
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1ButtonField.pdf" ;
202
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1ButtonField.pdf" ;
203
203
204
204
InputStream is = new FileInputStream (sourceFolder + "sRGB Color Space Profile.icm" );
205
205
@@ -225,7 +225,7 @@ public void pdfA1DocWithPdfA1ButtonFieldTest() throws IOException, InterruptedEx
225
225
public void pdfA1DocWithPdfA1CheckBoxFieldTest () throws IOException , InterruptedException {
226
226
String name = "pdfA1DocWithPdfA1CheckBoxField" ;
227
227
String fileName = destinationFolder + name + ".pdf" ;
228
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1CheckBoxField.pdf" ;
228
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1CheckBoxField.pdf" ;
229
229
230
230
InputStream is = new FileInputStream (sourceFolder + "sRGB Color Space Profile.icm" );
231
231
@@ -249,7 +249,7 @@ public void pdfA1DocWithPdfA1CheckBoxFieldTest() throws IOException, Interrupted
249
249
public void pdfA1DocWithPdfA1ChoiceFieldTest () throws IOException , InterruptedException {
250
250
String name = "pdfA1DocWithPdfA1ChoiceField" ;
251
251
String fileName = destinationFolder + name + ".pdf" ;
252
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1ChoiceField.pdf" ;
252
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1ChoiceField.pdf" ;
253
253
254
254
PdfFont fontFreeSans = PdfFontFactory .createFont (sourceFolder + "FreeSans.ttf" , "WinAnsi" , true );
255
255
InputStream is = new FileInputStream (sourceFolder + "sRGB Color Space Profile.icm" );
@@ -275,7 +275,7 @@ public void pdfA1DocWithPdfA1ChoiceFieldTest() throws IOException, InterruptedEx
275
275
public void pdfA1DocWithPdfA1ComboBoxFieldTest () throws IOException , InterruptedException {
276
276
String name = "pdfA1DocWithPdfA1ComboBoxField" ;
277
277
String fileName = destinationFolder + name + ".pdf" ;
278
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1ComboBoxField.pdf" ;
278
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1ComboBoxField.pdf" ;
279
279
280
280
PdfFont fontCJK = PdfFontFactory
281
281
.createFont (sourceFolder + "NotoSansCJKtc-Light.otf" , PdfEncodings .IDENTITY_H , true );
@@ -302,7 +302,7 @@ public void pdfA1DocWithPdfA1ComboBoxFieldTest() throws IOException, Interrupted
302
302
public void pdfA1DocWithPdfA1ListFieldTest () throws IOException , InterruptedException {
303
303
String name = "pdfA1DocWithPdfA1ListField" ;
304
304
String fileName = destinationFolder + name + ".pdf" ;
305
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1ListField.pdf" ;
305
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1ListField.pdf" ;
306
306
307
307
PdfFont fontFreeSans = PdfFontFactory .createFont (sourceFolder + "FreeSans.ttf" ,
308
308
"WinAnsi" , true );
@@ -334,7 +334,7 @@ public void pdfA1DocWithPdfA1ListFieldTest() throws IOException, InterruptedExce
334
334
public void pdfA1DocWithPdfA1PushButtonFieldTest () throws IOException , InterruptedException {
335
335
String name = "pdfA1DocWithPdfA1PushButtonField" ;
336
336
String fileName = destinationFolder + name + ".pdf" ;
337
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1PushButtonField.pdf" ;
337
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1PushButtonField.pdf" ;
338
338
339
339
PdfFont fontFreeSans = PdfFontFactory .createFont (sourceFolder + "FreeSans.ttf" ,
340
340
"WinAnsi" , true );
@@ -360,7 +360,7 @@ public void pdfA1DocWithPdfA1PushButtonFieldTest() throws IOException, Interrupt
360
360
public void pdfA1DocWithPdfA1RadioButtonFieldTest () throws IOException , InterruptedException {
361
361
String name = "pdfA1DocWithPdfA1RadioButtonField" ;
362
362
String fileName = destinationFolder + name + ".pdf" ;
363
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1RadioButtonField.pdf" ;
363
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1RadioButtonField.pdf" ;
364
364
365
365
InputStream is = new FileInputStream (sourceFolder + "sRGB Color Space Profile.icm" );
366
366
@@ -389,7 +389,7 @@ public void pdfA1DocWithPdfA1RadioButtonFieldTest() throws IOException, Interrup
389
389
public void pdfA1DocWithPdfA1TextFieldTest () throws IOException , InterruptedException {
390
390
String name = "pdfA1DocWithPdfA1TextField" ;
391
391
String fileName = destinationFolder + name + ".pdf" ;
392
- String cmp = sourceFolder + "cmp_pdfA1DocWithPdfA1TextField.pdf" ;
392
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/ cmp_pdfA1DocWithPdfA1TextField.pdf" ;
393
393
394
394
PdfFont fontFreeSans = PdfFontFactory .createFont (sourceFolder + "FreeSans.ttf" ,
395
395
"WinAnsi" , true );
@@ -411,4 +411,31 @@ public void pdfA1DocWithPdfA1TextFieldTest() throws IOException, InterruptedExce
411
411
Assert .assertNull (new CompareTool ().compareByContent (fileName , cmp , destinationFolder ));
412
412
Assert .assertNull (new VeraPdfValidator ().validate (fileName ));
413
413
}
414
+
415
+ @ Test
416
+ public void pdfA1DocWithPdfA1SignatureFieldTest () throws IOException , InterruptedException {
417
+ String name = "pdfA1DocWithPdfA1SignatureField" ;
418
+ String fileName = destinationFolder + name + ".pdf" ;
419
+ String cmp = sourceFolder + "cmp/PdfAFormFieldTest/cmp_pdfA1DocWithPdfA1SignatureField.pdf" ;
420
+
421
+ PdfFont fontFreeSans = PdfFontFactory .createFont (sourceFolder + "FreeSans.ttf" ,
422
+ "WinAnsi" , true );
423
+ fontFreeSans .setSubset (false );
424
+
425
+ InputStream is = new FileInputStream (sourceFolder + "sRGB Color Space Profile.icm" );
426
+
427
+ PdfAConformanceLevel conformanceLevel = PdfAConformanceLevel .PDF_A_1B ;
428
+ PdfADocument pdfDoc = new PdfADocument (new PdfWriter (fileName ), conformanceLevel ,
429
+ new PdfOutputIntent ("Custom" , "" ,
430
+ "http://www.color.org" , "sRGB IEC61966-2.1" , is ));
431
+
432
+ PdfAcroForm form = PdfAcroForm .getAcroForm (pdfDoc , true );
433
+ form .addField (PdfFormField .createSignature (pdfDoc , conformanceLevel ).setFieldName ("signature" )
434
+ .setFont (fontFreeSans ).setFontSize (20 ));
435
+
436
+ pdfDoc .close ();
437
+
438
+ Assert .assertNull (new CompareTool ().compareByContent (fileName , cmp , destinationFolder ));
439
+ Assert .assertNull (new VeraPdfValidator ().validate (fileName ));
440
+ }
414
441
}
0 commit comments