Convert Word DOCX to PDF with C# .NET & Apply Khmer Font to Page Numbers in Footer

Word to PDF convert on khmer font has format issues. Attached input and output documents

Tested in Version 17,19,20,21.khmer_tmp.docx (12.5 KB)

Input :
output : Screen Shot 2021-05-07 at 4.40.00 PM.png (56.9 KB)

@MEDHOK,

Please 1) upgrade to the latest 21.5 version of Aspose.Words for Java, 2) Enable OpenType Features and see how it goes on your end?

Please also convert this Word DOCX document to PDF format by using the “Save As” command of MS Word and attach it here for our reference.

Please also create and attach a comparison screenshot which highlights (encircles) the problematic areas in the Aspose.Words 21.5 generated PDF file (with respect to your expected MS Word generated document ) here for further testing.

Please also make sure that the following fonts are installed on your end:

  • Khmer UI
  • Arial
  • DaunPenh
  • Calibri

We will then investigate the issue further on our end and provide you more information.

@awais.hafeez

Please find the attached input PDF format and output document marked

Input : khmer_tmp.pdf (48.5 KB)

Output : Screen Shot 2021-05-07 at 4.40.00 PM.png (79.4 KB)

@MEDHOK,

I have converted your source word document (khmer_tmp.docx) to PDF format by using the following code of latest (21.5) version of Aspose.Words for Java API and attached it here for your reference (see awjava-21.5 OpenType Features Enabled.pdf (52.3 KB)).

Document doc = new Document("C:\\temp\\khmer_tmp.docx");
doc.getLayoutOptions().setTextShaperFactory(HarfBuzzTextShaperFactory.getInstance());
doc.save("C:\\Temp\\awjava-21.5.pdf");

I have also converted your source word document (khmer_tmp.docx) to PDF format by using the “Save As” command of MS Word 2019 and attached it here for your reference (see msw-2019.pdf (98.2 KB)).

Do you still see the same problems in these MS Word 2019 and Aspose.Words 21.5 generated PDF files on your end? I am afraid, I am not an expert in KHMER language, so please create and attach a ‘detailed comparison screenshot’ which highlights the problematic areas in Aspose.Words generated output here for our reference. Also, please elaborate what problems exactly are you seeing with Aspose.Words rendered KHMER language characters.

We will then investigate the issue further on our end and provide you more information.

Thanks for the help @awais.hafeez.

We have few other format issue resolved from 21.5 version, but still seeing problem with Footer text. Footer has auto generate Page number text which is rendered as Boxes. Attached the documents for reference.

Output : Khmer May 14 Generated Template.pdf (202.5 KB)
Input Template : Khmer May 14 Original Template .pdf (211.6 KB)

@MEDHOK,

You have attached a couple of PDF files in your previous post; but, we need source Word document, Aspose.Words generated PDF file showing the undesired behavior and your simple source code for testing on our end. Please compress these resources into ZIP format and attach the ZIP file here for further testing.

Hi @awais.hafeez,

Please find the attached source doc in word and output. Will send the sample code soon. Issue we are facing is mainly on Footer text. Footer are rendering as Boxes.

May 17 Generated Template (2).pdf (24.3 KB)
Original Khmer Template May 17.docx (17.3 KB)

@MEDHOK,

First off, you used a very old 17.9 version of Aspose.Words for Java to produce “May 17 Generated Template (2).pdf” on your end. We suggest you to please upgrade to the latest 21.5 version of Aspose.Words for Java. Secondly, please install the following font files on your machine where you are performing this DOCX to PDF conversion.

  • Times New Roman
  • Khmer OS Battambang

In case the problem still remains, then please also ZIP and attach “Khmer OS Battambang” font file here for further testing on our end.

@awais.hafeez… Sorry for the confusion. Attached the right output and the font as requested. We still have the issue with Footer.

Font lib
khmer-battambang.zip (163.3 KB)
Output
May 19 Generated Template.pdf (39.2 KB)

Input file is same as above

HI @awais.hafeez -

Footer issue is resolved. Thanks for the support and help.

@MEDHOK,

It is great that you were able to resolve this issue on your end. Please let us know any time you may have any further queries in future.