Arabic diacritics problem using Aspose words java

Dear,
When we are using Arabic diacritics the generated pdf output became different than word (little space added between arabic letters ).
I am using aspose-words-19.4-jdk17.jar , I also tried the latest version aspose-words-22.9-jdk16.jar but the same result.

com.aspose.words.Document doc;
try
{

	doc = new com.aspose.words.Document("C:/Users/muk/Desktop/Al Mohannad/AlMohannadTest.docx");
	doc.save("C:/Users/muk/Desktop/Al Mohannad/AlMohannadTest.pdf");
}
catch (Exception e)
{
	// TODO Auto-generated catch block
	e.printStackTrace();
}

Al Mohannad Font issue.zip (130.9 KB)

@mukhan12 To get the correct output should should enable open type features. Try using code like the following:

Document doc = new Document("C:\\Temp\\in.docx");
// Set fonts sources
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[] {new SystemFontSource(), new FolderFontSource("C:\\Temp\\fonts", true)});
// Enable open type features.
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());

doc.save("C:\\Temp\\out.pdf");

Here is the output document produced on my side using the above code: out.pdf (9.1 KB)

If you use maven project, you can add reference to com.aspose.words.shaping.harfbuzz JAR using the following dependency:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-words</artifactId>
    <version>22.9</version>
    <classifier>shaping-harfbuzz-plugin</classifier>
</dependency>

I am using jar file, where can i download jar file for shaping-harfbuzz-plugin ?

@mukhan12 Sure, you can get it from our repository: https://repository.aspose.com/words/22-9/

Thank you Alexey,

It is working.

1 Like