Boxes for Chinese, Japanese, Korean, Hebrew and other similar languages in Linux Environment

Hi,
I am using Aspose.Words for .NET to convert a Word document to PDF on Linux. However, the output PDF contains boxes for characters in Chinese, Japanese, Korean, Hebrew and other similar languages. On Windows, there is no issue.

Screenshot:

 Document newPdf = new Document(tempWordFile);
 newPdf.Save(downloadFilePath, Aspose.Words.SaveFormat.Pdf);

I am using Docker to deploy application on Linux.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        libfontconfig1 \
        libstdc++6 && \
    rm -rf /var/lib/apt/lists/*
    

COPY published/ ./
ENTRYPOINT ["dotnet", "app.dll"]

@uax99 Usually, such problems occur because the fonts used in your input document are not available on the machine where document is converted 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. 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/

Thank you for your response.

The issue is happening for PDF document only. If I process and then download the Word document, for example, I am editing the text provided in the source Word document and then downloading the updated document as DOCX/PDF format. The DOCX format contains the expected output without any issue. However, only PDF faces the issue.

@uax99 MS Word documents usually do not contain embedded fonts and the consumer applications uses the fonts installed in the system. So fonts are not required to generate MS Word documents. on other hand PDF document is fixed page format and fonts are required to render document to PDF.

1 Like

Thank you for sharing the information.

1 Like