New.pdf (11.1 KB)
New Microsoft Word Document.docx (13.1 KB)
Please see the documents above
@alin.neagu I cannot reproduce the problem on my side. Here is the PDF document produced on my side using the following code: out.pdf (20.5 KB)
Document doc = new Document("C:\\Temp\\in.docx");
doc.save("C:\\Temp\\out.pdf");
Most likely the problem occurs because fonts in your document are substituted. You can implement IWarningCallback to check whether fonts in your document are substituted.
Hi,
The conversion happens on a linux machine. Is there a work around so the bullet point doesn’t get substituted?
I have added the fonts to linux already and that works fine. It’s just the bullet points that are a bit dodgy
@alin.neagu The only possible way to fix this is adding the required fonts.
Also, there is a problem with bullets on Mac because Windows “Symbol” font is a symbolic font (like “Webdings”, “Wingdings”, etc.) which uses Unicode PUA but provided Mac “Symbol” font on the other hand is a proper Unicode font (for example Greek characters are in the U+0370…U+03FF Greek and Coptic block). So these fonts are incompatible and Mac “Symbol” font cannot be used instead of Windows “Symbol” without additional actions. In this particular case it is required to change the bullet codepoint from PUA U+F0B7 (or U+00B7 which also can be used in MW for symbolic fonts) to the U+2022 in the document to use the Mac “Symbol” font. See the following code for example:
Document doc = new Document("/Users/mac1/Downloads/BulletPoint.docx");
for (com.aspose.words.List lst : doc.getLists())
{
for (com.aspose.words.ListLevel level : lst.getListLevels())
{
if (level.getFont().getName().equals("Symbol") && level.getNumberFormat().equals("\uF0B7"))
{
level.setNumberFormat("\u2022");
}
}
}
doc.save("/Users/mac1/Downloads/out1.pdf");
Maybe this workaround can also help you to get better result on Linux.
I think I’m getting somewhere but now the clapperboards are being replaced with swards.
@alin.neagu Could you please attach your document and fonts, which are available on your side? This will help us to better analyze the issue and provide you a possible solution.
New Microsoft Word Document (2).docx (13.2 KB)
Hi, I attached an example. This gets converted fine in windows however when using the following docker image that runs Linux, it converts the symbols to a non desired symbol
openjdk:8u181-jre-slim
@alin.neagu Thank you for additional information. But on my side with no additional fonts installed in docker, the document is converted fine: out.pdf (10.5 KB)
All the fonts used in the document are substituted with Fanwood
font, which is the last resort font used by Aspose.Words.
Here are warnings:
Font 'Calibri' has not been found. Using 'DejaVu Sans' font instead. Reason: font info substitution.
2022-04-11T14:02:27.250245400Z Font 'Symbol' has not been found. Using 'DejaVu Sans' font instead. Reason: font info substitution.
and code:
Document doc = new Document("/temp/in.docx");
doc.setWarningCallback(new FontSubstitutionWarningCollector());
doc.save("/temp/out.pdf");
private static class FontSubstitutionWarningCollector implements IWarningCallback {
public void warning(WarningInfo info) {
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION)
System.out.println(info.getDescription());
}
}
I managed to fix it by adding the font Symbol to the container
Thanks for all the help!