Hi,
There is an error in conversion of Docx to PDF, where bullet points are converting into square’s
Hi,
There is an error in conversion of Docx to PDF, where bullet points are converting into square’s
When converting a DOCX file to PDF using Aspose.Words, if you encounter an issue where bullet points are being converted into squares, it is likely due to font embedding settings or missing fonts in the PDF output.
To resolve this issue, you can try the following steps:
Embed Fonts: Ensure that the fonts used in your DOCX document are embedded in the PDF. You can do this by setting the EmbedFullFonts property to true in the PdfSaveOptions. This will include all fonts used in the document, which can help prevent issues with missing characters.
Here is a code example in C#:
Document doc = new Document("input.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions
{
EmbedFullFonts = true
};
doc.Save("output.pdf", saveOptions);
And in Java:
Document doc = new Document("input.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setEmbedFullFonts(true);
doc.save("output.pdf", saveOptions);
Check Font Availability: Make sure that the fonts used in your DOCX document are installed on the system where the conversion is taking place. If the fonts are not available, Aspose.Words may substitute them with default fonts, which can lead to rendering issues.
Use Core Fonts: If you are using standard fonts like Arial or Times New Roman, you can set the UseCoreFonts property to true in the PdfSaveOptions. This will use the core fonts available in PDF viewers, which can help with compatibility.
Example in C#:
PdfSaveOptions saveOptions = new PdfSaveOptions
{
UseCoreFonts = true
};
Example in Java:
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setUseCoreFonts(true);
By following these steps, you should be able to resolve the issue with bullet points converting to squares during the DOCX to PDF conversion process. If the problem persists, consider checking the specific fonts used in your document and ensuring they are supported by Aspose.Words.
For more detailed guidance, you can refer to the Aspose documentation on document conversion and export options.
Sources:
[1]: Export Word Document Structure to PDF Document
[2]: Document Conversion and Export - Aspose
@Seema_C The problem might occur because Symbol font used for displaying billets in MS Word document is not available in the environment where document is rendered to PDF. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics and as a result incorrect page detection. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
In addition, the problem might occur due to the known peculiarity - Windows “Symbol” font (which is used for bullets) is a symbolic font (like “Webdings”, “Wingdings”, etc.) which uses Unicode PUA. MacOS or Linux “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/Linux “Symbol” font cannot be used instead of Windows “Symbol” without additional actions. In your particular case, it looks like, the bullet is represented as U+2022, but in Windows “Symbol” it is PUA U+F0B7 (or U+00B7 which also can be used in MS Word for symbolic fonts). So if you use Linux or Mac version of Symbol font, you should change U+2022 character to U+00B7:
Document doc = new Document(@"C:\Temp\in.docx");
List<Run> items = doc.GetChildNodes(NodeType.Run, true).Cast<Run>()
.Where(r => r.Font.Name == "Symbol").ToList();
foreach (Run r in items)
{
if (r.Text == "\x2022")
r.Text = "\x00b7";
}
doc.Save(@"C:\Temp\out.pdf");
But the simplest way to resolve the problem is installing Windows Symbol font. Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
If after providing the required fonts, the problem still persists, please attach your input and output documents here for testing. We will check conversion on our side and provide you more information.
Symbol font is available on the windows.
Here is the document
01-E507293-A6023-DescriptionUL (5).docx (78.7 KB)
@Seema_C Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side using the following simple code:
Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");
Here is he output produced on my side: out.pdf (140.2 KB)
What version of Aspose is used ?