Word to pdf Arabic format is not converted properly on Linux

Dears,

Using (aspose-words-21.6) to convert word file that contains Arabic letters to pdf file, It doesn’t view the Arabic format properly after the conversion on Linux server (on windows server working properly).

Please check the attached 2 files which are word file before conversion and pdf file after conversion.
aspose arabic letters format.pdf (30.8 KB)
check aspose arabic letters format .docx (12.1 KB)

Thanks in advance

@MohamadFardoun

You need to enable open type feature as shown below to get the desired output.

Document doc = new Document(MyDir + "check aspose arabic letters format .docx");
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
doc.save(MyDir + "21.6.pdf");

Please refer to the following article.

If you still face problem, please ZIP and attach the PDF file generated by latest version of Aspose.Words for Java i.e. 21.6. We will investigate the issue and provide you more information on it.

@tahir.manzoor

When I use Aspose.Words for Java i.e. 21.6, I get the following error:

 com.aspose.words.shaping.internal.zzWvb.zzGf
        java.lang.UnsatisfiedLinkError: com.aspose.words.shaping.harfbuzz.HB.hb_font_create_from_data([BI)J
                at com.aspose.words.shaping.harfbuzz.HB.hb_font_create_from_data(Native Method)
                at com.aspose.words.shaping.harfbuzz.zzYl6.zzWXs(Unknown Source)
                at com.aspose.words.shaping.harfbuzz.zzYl6.zzSb(Unknown Source)
                at com.aspose.words.shaping.harfbuzz.zzW9Z.<init>(Unknown Source)
                at com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getTextShaper(Unknown Source)
                at com.aspose.words.BasicTextShaperCache.getTextShaper(Unknown Source)
                at com.aspose.words.zzZh4.zzWXs(Unknown Source)
                at com.aspose.words.zzZh4.zzWXs(Unknown Source)
                at com.aspose.words.zzZNF.zzZK3(Unknown Source)
                at com.aspose.words.zzZNF.zztF(Unknown Source)
                at com.aspose.words.zzZvP.zztF(Unknown Source)
                at com.aspose.words.zzu0.zzZeT(Unknown Source)
                at com.aspose.words.zzWQe.zzWPp(Unknown Source)
                at com.aspose.words.zzWQe.zz3s(Unknown Source)
                at com.aspose.words.zzu0.zz3s(Unknown Source)
                at com.aspose.words.zzY54.zzYqY(Unknown Source)
                at com.aspose.words.zzY54.zzGf(Unknown Source)
                at com.aspose.words.zzY54.zzYZs(Unknown Source)
                at com.aspose.words.zzXgj.zzWXs(Unknown Source)
                at com.aspose.words.zzXgj.zzYEt(Unknown Source)
                at com.aspose.words.zzrC.zzWww(Unknown Source)
                at com.aspose.words.zzWrL.zzWYY(Unknown Source)
                at com.aspose.words.zzWrL.zzGf(Unknown Source)
                at com.aspose.words.zzWrL.zzLQ(Unknown Source)
                at com.aspose.words.zzZTX.zzWXs(Unknown Source)
                at com.aspose.words.zzZTX.zzWXs(Unknown Source)
                at com.aspose.words.zzZTj.zzXd5(Unknown Source)
                at com.aspose.words.zzZTj.zzYl6(Unknown Source)
                at com.aspose.words.zzZTj.zzWXs(Unknown Source)
                at com.aspose.words.zzYuL.zzXlh(Unknown Source)
                at com.aspose.words.zzYuL.zzGf(Unknown Source)
                at com.aspose.words.zzYuL.zzLQ(Unknown Source)
                at com.aspose.words.zzWx0.zzWYY(Unknown Source)
                at com.aspose.words.zzWx0.zzWeV(Unknown Source)
                at com.aspose.words.zzWx0.zzYNY(Unknown Source)
                at com.aspose.words.zzWx0.zztF(Unknown Source)
                at com.aspose.words.zzJ5.zzZtk(Unknown Source)
                at com.aspose.words.zzAn.zzkI(Unknown Source)
                at com.aspose.words.zzYqx.zzZtk(Unknown Source)
                at com.aspose.words.zzhN.zzWfj(Unknown Source)
                at com.aspose.words.zzZTm.zzVW6(Unknown Source)
                at com.aspose.words.Document.updatePageLayout(Unknown Source)
                at com.aspose.words.Document.zzYdK(Unknown Source)
                at com.aspose.words.Document.getPageCount(Unknown Source)
                at com.aspose.words.zz2i.zzYl6(Unknown Source)
                at com.aspose.words.zz2i.zzWXs(Unknown Source)
                at com.aspose.words.zzW4Z.zzWXs(Unknown Source)
                at com.aspose.words.Document.zzYl6(Unknown Source)
                at com.aspose.words.Document.zzWXs(Unknown Source)
                at com.aspose.words.Document.save(Unknown Source)
                at com.aspose.words.Document.save(Unknown Source)

@MohamadFardoun

Please use the latest version of Aspose.Words for Java 21.7, download ‘aspose-words-21.7-shaping-harfbuzz-plugin.jar’ and add it to your Java application to avoid this issue.

Please read the following article about installation of Aspose.Words for Java.

@tahir.manzoor

I used Aspose.words for java 21.7 and aspose-words-21.7-shaping-harfbuzz-plugin.jar and I’m still getting the same error

Thanks

@MohamadFardoun

We are investigating this issue and will get back to you soon.

@MohamadFardoun

We have tested the scenario using the latest version of Aspose.Words for Java 21.7 at Ubuntu and have not faced any exception. Please check the attached output PDF. 21.7.java.linux.pdf (29.6 KB)

Please remove all old Aspose.Words jar files from your application, install only latest version of Aspose.Words for Java, clean and build your application. Hope this helps you.

In case you are using different document, please ZIP and attach it here for testing.

I still get the same error even after deleting the old jars, note that i’m using Oracle Linux, not Ubuntu

@MohamadFardoun

Please download the document from the first post of this thread, convert the document to PDF and let us know if you face the same issue.

With following code example, we were unable to reproduce the issue. If your code is different, please share it here for further testing.

Document doc = new Document(MyDir + "check aspose arabic letters format .docx");
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
doc.save(MyDir + "21.7.pdf");

If you still face problem, please share the following detail for further testing.

  • Screenshot of IDE (code and exception stack trace).
  • Please create a JAR of your application that help us to reproduce the same issue at our end.
  • Please share the project type in which you are facing this issue e.g. simple Java application, OSGI, Java plugin etc.

Thanks for your cooperation.