Hi,
Checkboxes are updated with check() and unCheck().
If it still doesn't work, please upload the result file somewhere.
Tilman
Am 25.08.2022 um 08:47 schrieb Damaji Kalunge:
Hi Team,
I am ticking the checkbox using below code,/still the checkbox is not
checked in the filled PDF./
Could you please help out ? I have attached the sample image of PDF.
try {
PDDocument pDDocument = Loader.loadPDF(new File("src/main/resources",
"80.pdf")); if (pDDocument.isEncrypted()) {
try {
PDAcroForm pDAcroForm = pDDocument.getDocumentCatalog().getAcroForm(); COSDictionary
cosDictionary3 = pDAcroForm.getField("ap.sex").getCOSObject();
cosDictionary3.setString(COSName.V, "male");
OR
OSDictionary cosDictionary3 = pDAcroForm.getField("ap.sex").getCOSObject();
cosDictionary3.setString(COSName.V, "Male");
FileOutputStream fileOutputStream =new FileOutputStream(new File("src/main/resources",
"incrementalSave.pdf")); Set<COSDictionary> set =new HashSet<>();
set.add(cosDictionary1); set.add(cosDictionary2); set.add(cosDictionary3);
pDDocument.saveIncremental(fileOutputStream, set); pDDocument.close(); }
---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail:users-h...@pdfbox.apache.org