Foreign Language (KHMER font) not coverting to PDF from Word

Hello Support,
I have document content written in KHMER font. MS Word is showing them correctly but when I convert the word document to PDF using Aspose word library, all of KHMER content are showing as squar boxes. I have all variations/styles of KHMER font installed and restarted my laptop but the issue still exist.

I am attaching the sample document for your reference.

Thanks,
Parthiban

Sample_Font_KHMER.docx (20.8 KB)

I have tried all different version of Aspose word and pdf libraries (20.0 version to 24.7 version) and all of them showing square boxes.

@parthiban.natarajan Unfortunately, I cannot reproduce the problem on my side. Here is output produced by the following code on my side:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");

out.pdf (41.3 KB)

And here is output produced by the following code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
doc.Save(@"C:\Temp\out_HarfBuzz.pdf");

out_HarfBuzz.pdf (46.2 KB)

Hi Alexey,
showpdf.pdf (71.6 KB)

I have attached the output I am getting when I used the following code in all version of Aspose

Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Sample_Font_KHMER.docx");
doc.Save(@"D:\Sample_Font_KHMER.pdf", Aspose.Words.SaveFormat.Pdf); 

Are you able to see if any different font used than KHMER? If possible can you upload the particular font used by this document to this ticket?

Thanks,
Parthiban

@parthiban.natarajan On my side the following font is used for rendering KHMER:
daunpenh.zip (77.4 KB)

Hi Alexey,
Thanks for sharing the font file. Now I am able to see the correct font in the PDF document post conversion. Initially when I was trying to list all fonts used by the document, I have not noticed KHMER or DAUNPENH but all regular fonts pulled in. Here is the sample code that I used to list the font used in the document.

Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Sample_Font_KHMER.docx");
FontInfoCollection docFonts = doc.FontInfos;
foreach (Aspose.Words.Fonts.FontInfo fontInfo in docFonts)
{
    this.ltrlFontCollection.Text += "<tr><td> " + fontInfo.Name + "</td><td>" + fontInfo.AltName + "</td><td>" + fontInfo.Family.ToString() + "</td></tr>";
}
this.ltrlFontCollection.Text += "</table>";

Font Collection and Properties:

Name Alt Name Family
Symbol Roman
Times New Roman Roman
Arial Swiss
Calibri Swiss
Aptos Display Swiss
Aptos Swiss

Thanks,
Parthiban

@parthiban.natarajan It is not mandatory that FontInfos have actual information. If Aspose.Words cannot find the font used in the document, the font is substituted. You can implement IWarningCallback to get notifications when font substitution is performed.

Hi Alexey,
Thanks for the quick response. Will IWarningCallback would give any clue of actual font used before substituting?
Thanks,
Parthiban

@parthiban.natarajan Yes, the warning will inform about the requested font and the font that will be used instead.