We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Render Thai language Text in DOCX to PDF using OpenType Features of Aspose.Words API

Hello,
You will find attached the standalone application you requested.
Thank you in advance!

Best regards.
Mohamed.

AsposePDF.zip (4.6 MB)

@mhamitouche,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19576. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Hello,
Thank you for your reply.
I’m waiting for your answer.
Thanks in advance.
Mohamed.

@mhamitouche,

Your issue (WORDSNET-19576) is currently pending for analysis and is in the queue. We will inform you via this thread as soon as this issue will be resolved in future.

@mhamitouche,

Regarding WORDSNET-19576, it is to update you that Aspose.Words can now render such Thai language in this document correctly with the help of the HarfBuzz shaping engine. This requires installing the Aspose.Words.Shaping.Harfbuzz nuget package and adding an extra line of code:

var doc = new Document(@".\Template.docx");
doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
doc.Save(@".\Template.pdf");

To learn more about OpenType features, please refer to the following article:

I just applied your correction, and visibly, it works well.
Thank you for your help, I’m grateful.

Best regards,
Mohamed.

@mhamitouche,

Thanks for your feedback. It is great that installing the Aspose.Words.Shaping.Harfbuzz nuget package and adding an extra line of code doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance; works for you.

In case you have further inquiries or need any help in future, please let us know.

Hello Hafeez,
After doing some tests, we discovered another bug:
"Text shaper factory failed to return text shaper for ‘C:\windows\Fonts\calibri.ttf’, face index ‘0’"
While searching the Internet, I did not find a solution.
Here is the file used:
Template.zip (76.7 KB)
By checking the Fonts available on my machine, everything seems correct.
Thank you in advance.
Mohamed.

@mhamitouche,

I am afraid, we do not see any issue when running the following code with Aspose.Words for .NET 19.11 and Aspose.Words.Shaping.HarfBuzz 19.11 on our end:

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

Please remove/uninstall Aspose.Words for .NET and Aspose.Words.Shaping.HarfBuzz from your Visual Studio project.
Then add reference to Aspose.Words for .NET 19.11 package (latest version)
And then add reference to Aspose.Words.Shaping.HarfBuzz 19.11 package (latest version)

Hope, this resolves your problem.

Hi,
Sorry for the delay, I was on vacation.
My script works when I set, in the properties of my VS project, this configuration:
Platform target: Any CPU. Prefer 32-bit.
or
Platform target: x86.

I’m on Windows 10, x64.

Mohamed.

@mhamitouche,

Can you please ZIP and attach a simplified Visual Studio project in which you are unable to add reference to Aspose.Words.Shaping.HarfBuzz 19.11 package via NuGet? Thanks for your cooperation.

Hi,
Find attached the requested Console application:
AsposePDF.zip (9.6 MB)

Working configuration:
Aspose_AnyCPU_Prefer_32-bit.jpg (31.0 KB)

Thank you in advance.
Mohamed.

@mhamitouche,

When running your project, we have managed to observe the following error on our end.

  • Text shaper factory failed to return text shaper for ‘C:\WINDOWS\Fonts\calibri.ttf’, face index ‘0’

In the “Solution Explorer”, right click “AsposePDF” project and choose “Manage NuGet Packages”. In the “Updates” tab, you will see Aspose.Words entry. Updating Aspose.Words to 19.12 version will also update the “Aspose.Words.Shaping.HarfBuzz” to 19.12. Rebuild the project and Run it. It should work now.

Hello,
Thank you for your availability.
Looking in NuGet repository, it seems to me that the version 19.12.0 of Aspose.Words.Shaping.HarfBuzz does not exist.
To see here:

Aspose.Words.Shaping.HarfBuzz 19.11.0 is not compatible with Aspose.Words 19.12.0.
I had this error at installation:

Unable to resolve dependencies. ‘Aspose.Words 19.12.0’ is not compatible with ‘Aspose.Words.Shaping.HarfBuzz 19.11.0 constraint: Aspose.Words (= 19.11.0)’.

After that, I installed Aspose.Words.Shaping.HarfBuzz 19.11.0 by disabling dependencies (NuGet > Options > Ignore Dependencies).

Now, with Aspose.Words 19.12.0 and Aspose.Words.Shaping.HarfBuzz 19.11.0 installed, I have no more errors with Any CPU and x64 target platform configs, but I have the same error like before with x86 and Any CPU Prefer 32-bit target platform config.

I’m on Windows 10, 64-bit.

@mhamitouche,

We have just published Aspose.Words.Shaping.HarfBuzz 19.12 version on NuGet. We tested it on our end and it worked fine along with Aspose.Words for .NET 19.12 even in x86 and Any CPU Prefer 32-bit target platform configuration.

So, please upgrade to Aspose.Words for .NET 19.12 and Aspose.Words.Shaping.HarfBuzz 19.12 and see how it goes on your end? Hope, this helps.

Hello,
Sorry for the delay, I was on vacation for 10 days.
Now, the new version of Aspose.Words.Shaping.HarfBuzz is present on NuGet repository.
When I test with my Cosole app, everything works fine.
On the other hand, in our Solution, it does not work because, I think, of the following DLLs which are not up to date:
- Aspose.BarCode
- Aspose.Slides
- Aspose.Cells (Updated recently)

The solution might be to update these two DLLs as well.

Thanks in advance.
Mohamed.

@mhamitouche,

Yes, please upgrade to the latest versions of these APIs from the following links:

In case the problem still remains with any of the above APIs, please feel free to report it in respective forum(s).

Hello,
There are always exceptions.
New topic created:
Aspose DLL exception
Thank you.

Mohamed.

@mhamitouche,

Thanks for creating a new topic and please follow that thread for further proceedings.

A post was split to a new topic: Render Thai Language Text in XLSX to PDF using C#