I have a docx template containing FORMDROPDOWN
fields. I am saving it to PDF using the following code:
@Override
public byte[] writeFile(Document document, String fileExtension) throws IOException {
document.getFieldOptions().setFieldUpdateCultureSource(FieldUpdateCultureSource.FIELD_CODE);
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.save(outputStream, saveOptions);
return outputStream.toByteArray();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
When printing the PDF, I see borders around the dropdown choices.
With Acrobat professional I can control how dropdown borders are handled using this setting:
Can I control this also via the Aspose API?
The template I am using:
dropdown-test.docx (36.0 KB)
The result I am getting:
dropdown-test-out.pdf (49.5 KB)
When you open the print preview, you can already see, that the dropdown will be rendered with a border.