I have the following Word tempalte:
When I save this docx via Aspose API, I get the following result (depending on the “fillable” DocProp beeing true or false):
I generate the PDF file using the following code:
public byte[] writeFile(Document document, String fileExtension) throws IOException {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
SaveOptions saveOptions = SaveOptions.createSaveOptions(SaveFormat.fromName(fileExtension.toUpperCase()));
if(saveOptions instanceof PdfSaveOptions pdfSaveOptions){
pdfSaveOptions.setPreserveFormFields(true);
pdfSaveOptions.setUpdateFields(true);
}
document.getFieldOptions().setFieldUpdateCultureSource(FieldUpdateCultureSource.FIELD_CODE);
document.save(outputStream, saveOptions);
return outputStream.toByteArray();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Attached the test files.
Why is there an extra input field in the PDF files?
How can I get rid of that?
Many thanks!
example.docx (25.6 KB)
file.pdf (40.9 KB)
file2.pdf (41.6 KB)