check box is not printing properly while generating the pdf using aspose words jar 23.9, I tried generating in docx and the check box got printed properly but while generating in pdf format has the check box issue getting printed as double dots. please find the attached template and the pdf screen shots
It appears you are encountering an issue with checkboxes not rendering correctly in the PDF output when using Aspose.Words. This can occur due to the differences in how forms and checkboxes are handled between Word documents and PDF files.
To resolve this issue, please follow these steps:
-
Use PdfSaveOptions: When saving your document to PDF, ensure you are utilizing the
PdfSaveOptionsclass. This class allows you to specify options that can influence how the document is rendered in PDF format. -
Preserve Form Fields: Set the
PreserveFormFieldsproperty totruein yourPdfSaveOptions. This setting helps maintain the integrity of form fields, including checkboxes, in the PDF output.
Here’s a sample code snippet to illustrate how to implement this:
Document doc = new Document("YourDocument.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions
{
PreserveFormFields = true
};
doc.Save("Output.pdf", saveOptions);
-
Check PDF Compliance: If you are using specific PDF compliance settings (such as PDF/A), ensure that these settings are compatible with the features utilized in your document.
-
Update Aspose.Words: If you are using an older version of Aspose.Words, consider updating to the latest version. There may have been fixes or enhancements related to PDF rendering in newer releases.
If the issue persists after trying these steps, you may want to examine the specific properties of the checkboxes in your Word document or consult the Aspose documentation for more detailed rendering options.
For additional assistance, you can also explore the Aspose forums or documentation for similar issues and solutions.
If you have any further questions or need additional help, please feel free to ask!
@manasag Could you please attach your actual input and output documents here for testing? We will check the issue and provide you more information. unfortunately, it is impossible to analyze the problem using screenshots.
I tried adding the above piece of code but still the issue is not resolved
@manasag The problem is not reproducible on my side using the latest 25.8 version of Aspose.Words for java and the following simple code:
Document doc = new Document("C:\\Temp\\in.dot");
doc.save("C:\\Temp\\out.pdf");
Here is the produced output: out.pdf (125.0 KB)
Most likely the problem occurs because the fonts used in the document are not available in the environment where document is rendered to PDF. If Aspose.Words cannot find the fonts used in the document the fonts are substituted . This might lead into the layout differences due to differences in fonts metrics. You can implement IWarningCallback to get a notification when font substitution is performed.
The following articles can be useful for you:
https://docs.aspose.com/words/java/specify-truetype-fonts-location/
https://docs.aspose.com/words/java/install-truetype-fonts-on-linux/
document.setWarningCallback(new IWarningCallback() {
public void warning(WarningInfo info) {
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
System.out.println("Font substitution: " + info.getDescription());
}
}
});
PdfSaveOptions options = new PdfSaveOptions();
options.setPreserveFormFields(true);
options.setSaveFormat(SaveFormat.PDF);
document.save(byteArrayOutputStream,SaveFormat.PDF);
I tried using IWarningCallback but no warnings are printed in the logs
we previously used 16.11 aspose words jar at that time we didn’t had any such issue with check box after upgrading to 23.9 we are seeing this issue
In the pdf there are some check boxes that got printed properly but few were printed as ** instead of check box
20970458-sample.pdf (204.0 KB)
The above is the problematic pdf, please refer to page 4 where the check box was expected to be printed instead of double dots. where as in page 5 has the check boxes printed. not sure why some are getting printed and some or not.
@manasag As I can see you are using an old 23.9 version of Aspose.Words. Please try using the latest 25.8 version and let us know if the problem still persists.
Also, I see fonts used in your PDF document differs from fonts used in PDF produced on my side. Please try implementing IWarningCallback as suggested above to check whether font substitution is performed on your side.
I tried using IWarningCallback but didn’t see any warnings printed in the log.
Can you suggest any other code fix in order to make this check box print properly using the same 23.9 jar as we had completed all the testing with this jar using the latest jar might need the testing to be performed again from scratch.
@manasag I see that the output PDF file is slightly different from .dot. Is it correct that the file you provided was inserted into another document? If so, could you please provide the code you are using and all the files involved in the process?

