Bulleted lists inserted via documentBuilder.insertHtml don't export to PDF properly

I’m creating documents using the DocumentBuilder class and the insertHtml command. When I insert a bulleted list, it looks fine in the word document, but is missing the bullet character in the PDF document. Ordered lists look fine, it only seems to be bulleted lists that have a problem.

I’m using aspose.words 10.1.0 for Java. I’ve attached sample code and sample output that shows the problem.

Can you suggest a work-around or fix?

Here’s code to reproduce the problem:

import com.aspose.words.*;
public class Test {
    public static void main(String[] args) throws Exception {
        String[] fontPath = new String[] {"/Library/fonts/", "/Library/Fonts/Microsoft/"};
        FontSettings.setFontsFolders(fontPath, false);
        Document document = new Document();
        DocumentBuilder builder = new DocumentBuilder(document);
        builder.insertHtml("<ul><li>item 1</li><li>item 2</li></ul>");
        document.save("Test.doc", SaveFormat.DOCX);
        PdfSaveOptions options = new PdfSaveOptions();
        document.save("Test.pdf", options);
    }
}

Hi
Thanks for your request. The problem probably occurs because Symbol font is not available on your side. PDF document is rendered fine on my side. Please see the attached document. Also, see the attached screenshot that shows difference between your PDF and mine.
Best regards,

That makes sense. Thanks for the fast response, I really appreciate it.

Is there a way to change the font that is used for the bullet symbol? Or is there a way to change the bullet symbol to a glyph that is included in Times New Roman or a different font? We actually ran into the problem using Palatino as our font, and it seems like it should use the palatino bullet glyph.

Thanks

Hi
Thanks for your request. Of course, the easiest way to resolve the problem is simply installing the Symbol font.
However, you can also reset bullets in your document as shown below:

Document doc = new Document("C:\\Temp\\Test.doc");
// Replace all bullets with "\u2022" character (ò) and reset font.
NodeCollection <Paragraph> paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph par: paragraphs)
{
    if (par.isListItem() && par.getListFormat().getListLevel().getNumberStyle() == NumberStyle.BULLET)
    {
        par.getListFormat().getListLevel().setNumberFormat("\u2022");
        par.getListFormat().getListLevel().getFont().setName("Times New Roman");
    }
}
doc.save("C:\\Temp\\out.pdf");

Hope this helps.
Best regards,

Excellent. That is exactly what I needed to solve my problem.

Thank you for your help