Hi Team -
I have one docx file in Gujarati language while saving that file to PDF the characters are getting changed.
aspose java version: 18.12 (jdk16)
Java version: java8
sample-gujarati.docx (13.5 KB)
sample-gujarati.pdf (50.3 KB)
SS from DOCX
SS from PDF
String source = "sample-gujarati.docx";
String dest = "sample-gujarati.pdf";
Document document = new Document(source);
document.save(dest, SaveFormat.PDF);
Could you please help me with the code.
@kevalpshaip Advanced typography features are used in your document. Advanced typography features are supported by Aspose.Words via Aspose.Words.Shaping.HarfBuzz package.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>23.11</version>
<classifier>shaping-harfbuzz-plugin</classifier>
</dependency>
You should install the above package and modify the code as shown below:
Document doc = new Document("C:\\Temp\\in.docx");
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
doc.save("C:\\Temp\\out.pdf");
See more about advanced typograph features in the documentation: https://docs.aspose.com/words/java/enable-opentype-features/
@alexey.noskov
Thanks for your prompt response.
The fonts used in the docs are of truetype and the URL you have shared is for opentype.
I have several dependencies on aspose version (18.12) so if you could help me with the solution for version (18.12) would be great. Thanks!
@kevalpshaip I am afraid there is no solution of the problem for 18.12 version of Aspose.Words, since there is no aspose.words.shaping.harfbuzz
package available for this version of Aspose.Words. The only solution I can suggest is updating to the newer version and using aspose.words.shaping.harfbuzz
package as described above.