Render Thai Language Text of Word DOCX Document to PDF using HarfBuzz Package of Aspose.Words (C# .NET)

When saving the Word file to pdf file, Pdf file show wrong format in thai language.
Font: Cordia New

@sorawee,

Please upgrade to the latest (20.7) version of Aspose.Words for .NET and try running the following code:

Document doc = new Document("E:\\temp\\Thai.docx");
doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
doc.Save("E:\\Temp\\20.7-HarfBuzz.pdf");

Please also refer to the following pages:

In case the problem still remains, please ZIP and attached the following resources here for testing:

  • Your simplified input Word document containing the Thai language text
  • Font files used in your Word Document (Cordia New etc)
  • Aspose.Words for .NET 20.7 generated output PDF file showing the undesired behavior
  • Your expected PDF file showing the desired output. You can create this document by using MS Word.
  • A comparison screenshot highlighting the problematic areas in above Aspose.Words 20.7 generated document (with respect to your expected file)

As soon as you get these pieces of information ready, we will start further investigation into your particular scenario and provide you more information.

I did as you said but still error and I attach zip file detail.
Information Error.zip (357.3 KB)

@sorawee,

We have installed the font file that you shared and then converted your “Input Word.docx” to PDF by using the code from my previous post and attached the PDF file here for your reference:

Regarding the exception you shared in “comparison screenshot.png”, please first remove Aspose.Words for .NET and Aspose.Words.Shaping.HarfBuzz references from your visual studio project. After that install the ‘latest 20.7 versions’ of Aspose.Words for .NET and Aspose.Words.Shaping.HarfBuzz packages from NuGet. Hope this helps.