Hello Support Team,
We are using Aspose Words for Java to convert Word documents to PDF. We are facing the Problem that bullet points are not displayed correct in the generated PDF.
We are using Aspose Words in version “18.3-jdk16” and docker as execution environment. Our base image is “openjdk:11-jre-slim”. We are also installing the “ttf-mscorefonts” as replacemnnt for the windows fonts.
In the resulting PDF, the bullet points of the first and third level are weird. See the attached PDF file with_ttf-mscorefonts.pdf (433.5 KB). We also tried to install different font packages, e.g., “ttf-ancient-fonts-symbola”, “fonts-opensymbol”, “fonts-noto” and then substitute the font explicit but then the bullet points are only empty rectangles even though the fonts are embedded inside the DPF file. Updating to version 21.4 did not solve the problem.
What do we need to do that the bullets points inside the PDF are displayed similar to the Word document?
We would be very grateful for any help.
Thanks
@alexander.g
Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you are converting documents to PDF. Please refer to the following articles:
Using TrueType Fonts
Manipulating and Substitution TrueType Fonts
Please make sure that the symbol font is installed on the system where you are converting document to PDF.
Moreover, you can implement IWarningCallback interface as shown below to get the missing font notification. You need to install those missing fonts to get the desired output.
Document doc = new Document(MyDir + "input.docx");
doc.setWarningCallback(new IWarningCallback() {
@Override
public void warning(WarningInfo warningInfo) {
if (WarningType.FONT_SUBSTITUTION == warningInfo.getWarningType()) {
System.out.println(warningInfo.getDescription());
}
}
});
doc.save(MyDir + "output.pdf");
@tahir.manzoor
Thank you for your feedback. I added the IWarningCallback. Also, I installed “ttf-mscorefonts” and “fonts-opensymbol”. I get the following output:
Font substitutes: 'Calibri' replaced with 'Liberation Sans'.
Font 'Wingdings' has not been found. Using 'OpenSymbol' font instead. Reason: closest match according to font info from the document.
Font 'Symbol' has not been found. Using 'OpenSymbol' font instead. Reason: closest match according to font info from the document.
From that point the font replacement works fine. On the resulting PDF the first and seconds bullets points are well. But the third level seems to be not correct. Please look to the attached file. ttf-mscorefonts_and_opensymbol.pdf (494.1 KB)
By default Word uses as glyph for the third level the Wingdings font with codepoint 162 (decimal). The Problem is that the fonts OpenSymbol and Webdings does not provide similar glyph at codepoint 162 like Wingdings.
Do you have a recommendation which font to use as replacement for Wingdings? Or is there a way to control the font and codepoint for bullets points by API?
@alexander.g
We have logged your requirement in our issue tracking system as WORDSNET-22221. We will inform you via this forum thread once there is an update available on it.
@tahir.manzoor
Thank you a lot