Convert Table Text with Proportional Font (Advanced Typography Proportional Figures) in Word document to PDF using Java

ConvertPropTabletoPdf.zip (187.6 KB)
Hello all, we are facing a problem with conversion of Word document to PDF.
In our Word Document are two tables.

  • One table with tabular setting (Font - Advanced - openType features - number spacing = tabular)

  • Second table with proportional setting (Font - Advanced - openType features - number spacing = proportional)

After conversion to PDF with (Aspose.words for java 19.6) both table have the same tabular font, which is wrong. We expect for each table a different font.

I will upload a ZIP File with all necessary files:

  • tableWithPropFont.docx - original Word document
  • tableWithPropFontWrong.pdf - resulting wrong PDF
  • ConvertProptableToPDF.java - Java Unit test class
  • firstTableNumberSpacingTabular.jpg - font settings in Word
  • SecondTableNumberSpacingProportional - font settings in Word

Please could you have a look
Anne

@wroet001,

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-18776. 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.

The issues you have found earlier (filed as WORDSNET-18776) have been fixed in this Aspose.Words for .NET 19.12 update and this Aspose.Words for Java 19.12 update.

Hello all, we have now tested the case above again with 19.12 and even 20.2 but the result is still wrong. The proportional font in the second table is wrongly converted to the tabular font as in the first table in the resulting PDF.
Please could you check this again?
Thanks a lot
Anne

@wroet001,

Thanks for reporting this problem to us. To investigate it further, we have logged a new issue with ID WORDSNET-20112. We will keep you posted on further updates and let you know when this will be resolved in future. We apologize for your inconvenience.

@wroet001,

The problematic text uses an Advanced Typography called “Proportional Figures” and the Advanced Typography is supported via an external shaping engine. The engine should be enabled in your code to get the desired output:

Document doc = new Document("E:\\Temp\\ConvertPropTabletoPdf\\tableWithPropFont.docx");
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
doc.save("E:\\Temp\\ConvertPropTabletoPdf\\awjava-20.3-harfbuzz.pdf");

Aspose.Words for Java’s output with advanced typography enabled is attached here for your reference:

Please also refer to the following article:

Hope, this helps.