Checkboxes Not being correctly filled in DOC to PDF for Aspose Total for Java

Hi,

We are using Aspose Total for Java to convert different files to PDFs.
In this case, we are converting a Word file to PDF, The word contains check boxes.
Those checkboxes are not converted to PDF correctly.

There are two issues:

  1. A question mark replaces the cross.
  2. The question mark is placed on a random checkbox which is not even checked on the original document. The checkbox which was originally checked does not have a checkmark.

The code snippet to convert Word to PDF is added below:

private void wordToPDF(InputStream inputFile, ByteArrayOutputStream output) throws Exception {
        com.aspose.words.Document wordDoc = new com.aspose.words.Document(inputFile);

        com.aspose.words.FontSettings fontSettings = new com.aspose.words.FontSettings();
        fontSettings.setFontsFolder(ResourceUtils.getFile("classpath:fonts").toPath().toString(), true);
        wordDoc.setFontSettings(fontSettings);
        wordDoc.setWarningCallback(new com.aspose.words.IWarningCallback() {
            @Override
            public void warning(com.aspose.words.WarningInfo warningInfo) {
                if (WarningType.FONT_SUBSTITUTION == warningInfo.getWarningType()) {
                    log.info("Missing Fonts Errors: ");
                    log.info(warningInfo.getDescription());
                }
            }
        });
        wordDoc.save(output, com.aspose.words.SaveFormat.PDF);
    }

I had added a warning to indicate if there is a missing font but got no such warning.

The versions of aspose we are using are below:

<dependency>
			<groupId>com.aspose</groupId>
			<artifactId>aspose-pdf</artifactId>
			<version>23.4</version>
		</dependency>
		<dependency>
			<groupId>com.aspose</groupId>
			<artifactId>aspose-words</artifactId>
			<version>23.4</version>
			<classifier>jdk17</classifier>
		</dependency>
		<dependency>
			<groupId>com.aspose</groupId>
			<artifactId>aspose-cells</artifactId>
			<version>22.5</version>
		</dependency>
			<dependency>
				<groupId>com.aspose</groupId>
				<artifactId>aspose-slides</artifactId>
				<version>21.10</version>
				<classifier>jdk16</classifier>
			</dependency>
			<dependency>
				<groupId>com.aspose</groupId>
				<artifactId>aspose-slides</artifactId>
				<version>21.10</version>
				<classifier>javadoc</classifier>
			</dependency>
		<dependency>
			<groupId>com.aspose</groupId>
			<artifactId>aspose-imaging</artifactId>
			<version>22.5</version>
			<classifier>jdk16</classifier>
		</dependency>
		<dependency>
			<groupId>com.aspose</groupId>
			<artifactId>aspose-diagram</artifactId>
			<version>21.11</version>
			<classifier>jdk16</classifier>
		</dependency>

@momin.siddique Could you please attach your problematic input and output documents here for testing? We will check the issue and provide you more information.

@alexey.noskov, I have attached both the problematic pdf and the source word document.
We have recently updated the versions of Aspose PDF and Aspose Words
to 25.2

Please let us know of any updates on this issue.

T-254421 MED-4860 Silicone Material Specification Rev A (1).pdf (128.5 KB)

T-254421 MED-4860 Silicone Material Specification Rev A (1).docx (67.6 KB)

@momin.siddique Thank you for additional information. I cannot reproduce on my side using the latest 25.2 version of Aspose.Words for Java and the following simple code:

Document doc = new Document("C:\\Temp\\in.docx");
doc.save("C:\\Temp\\out.pdf");

out.pdf (108.6 KB)

As I can see Segoe UI Symbol and MS Gothic Regular fonts are used to render checkboxes on my side. These fonts are not present in your PDF document. Please try installing these fonts.

Thanks @alexey.noskov. adding the missing fonts resolved the issue.

1 Like