Incorrect Rendering of Marathi Text When Converting DOCX to PDF in Aspose.Words 25.5 (Trial License)

Hello,

We are using Aspose.Words for .NET v25.5 with a free trial license to generate PDF documents containing text in Marathi (Devanagari script).

Issue Observed:

  • When we generate the output as DOCX using Aspose.Words, the Marathi text displays perfectly.

  • However, when we convert the same DOCX to PDF using Aspose.Words, the characters are not shaped or joined correctly.

  • As a result, the text becomes difficult to read because proper Devanagari letter rendering is lost.

Request:
Could you please advise why this issue is occurring and suggest the correct approach or settings required to preserve proper complex script rendering for Marathi (and all Indian languages) when converting DOCX to PDF?

For your reference, I have attached:

We look forward to your guidance on resolving this issue.

Thanks & Regards,
Shrutika

@XECOM

Hello Shrutika,

It sounds like you’re experiencing issues with the rendering of Marathi text when converting DOCX to PDF using Aspose.Words. This is often due to font embedding and the handling of complex scripts.

Cause: The primary reason for the rendering issues is likely related to font embedding and the availability of the correct fonts for Marathi text.

Solution: Here are some steps you can take to ensure proper rendering of Marathi text:

  1. Embed Full Fonts: When saving the document as a PDF, set the EmbedFullFonts property to true. This ensures that the entire font file is embedded in the PDF, which can help with complex script rendering.

    PdfSaveOptions options = new PdfSaveOptions();
    options.EmbedFullFonts = true;
    doc.Save("output.pdf", options);
    
  2. Font Settings: Ensure that the correct fonts are available and accessible to Aspose.Words. You may need to specify the font sources explicitly if the default settings do not include the necessary fonts for Marathi.

    FontSettings fontSettings = new FontSettings();
    fontSettings.SetFontsSources(new FontSourceBase[] {
        new FolderFontSource("C:\\PathToYourFonts", true)
    });
    doc.FontSettings = fontSettings;
    
  3. Use Noto Fonts: Consider using Google Noto fonts, which are designed to support a wide range of languages, including those using Devanagari script. You can load predefined fallback settings for Noto fonts to enhance character rendering.

    fontSettings.FallbackSettings.LoadNotoFallbackSettings();
    
  4. Check for Font Substitution Warnings: Implement a warning callback to catch any font substitution issues during the document processing. This can help identify if any fonts are not being found.

    doc.WarningCallback = new DocumentSubstitutionWarnings();
    

Next Steps: By following these steps, you should be able to improve the rendering of Marathi text in your PDF output. If you continue to face issues, please let me know, and we can explore further options together.

Thank you, and I look forward to your feedback!

@XECOM Could you please attach your actual input and output documents here for testing? We will check the issue and provide you more information.

Most likely, to get the output closer to MS Word it is required to enable open type features. Aspose.Words.Shaping.Harfbuzz package provides support for OpenType features in Aspose.Words using the HarfBuzz text shaping engine. You should enabling open type features to get the expected result. To achieve this you should add reference to Aspose.Words Shaping Harfbuzz plugin and use the following code to convert your document:

Document doc = new Document(@"C:\Temp\in.docx");
doc.LayoutOptions.TextShaperFactory = Aspose.Words.Shaping.HarfBuzz.HarfBuzzTextShaperFactory.Instance;
doc.Save(@"C:\Temp\out_HarfBuzz.pdf");

Hello ,

Thank you for your response.

As requested, I have attached the actual input DOCX file and the output PDF file generated using Aspose.Words for .NET v25.5
50495_SN PUN 25000227 1.pdf (117.7 KB)

50495_SN PUN 25000227 1.Docx (43.7 KB)

@XECOM As it was suspected, it is required to enable open type features as described above to get the correct output. Here is the output produced on my side:
out_HarfBuzz.pdf (83.4 KB)

Hi,

Thank you for your guidance. I tried all the suggested steps, but the Marathi text still shows incorrect shaping/joining in the PDF output.

@XECOM As I can see PDF produced on my side looks the same as PDF produced by MS Word:
ms.pdf (147.5 KB)

Also, I noticed that fonts used in the PDF you have attached differs from fonts used in PDF produced on my side. Usually, the such problems occur because the fonts used in your input document are not available on the machine where document is converted to PDF. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/

Hi,
Thank you for the guidance.
I am now facing a new issue: when generating and sending the PDF from my local development environment, the file opens correctly (around 120 KB). But when the same service is deployed on the server, the generated PDF is only about 1 KB and does not open.

Could you please advise what might cause the PDF to open fine locally but fail when generated on the server?

@XECOM Could you please zip and attach the problematic output document and provide code you use to save and sent the file? We will check the issue and provide you more information.

Hi,
I have uploaded the problematic output document in a zip folder along with a snapshot of the code used for saving and sending the file. Please review and let me know your observations. For context, the issue occurs only on the server — in the local development environment the PDF is generated correctly.
WordToPdfMarathi.zip (177.1 KB)

@XECOM Thank you for additional information. As I can see the PDF file is truncated. It contains only PDF document header and a few more bytes:

Could you please check whether the PDF document saved by Aspose.Words to file before sending it via e-mail looks fine? I do not think the problem is in Aspose.Words. I suspect the PDF document bytes are improperly attached to the e-mail body or are truncated in some other place.

Hi,
We are converting RDL reports → DOCX → PDF using Aspose.Words with HarfBuzz.
All other languages (Marathi, Hindi, Kannada, etc.) render fine, but Tamil text is not displaying correctly in the PDF, even though it looks fine in the DOCX.

Could you please guide us on how to make Tamil text render correctly in the PDF?

@XECOM Could you please attach your problematic input DOCX and output PDF documents here for testing? We will check the issue and provide you more information.

As requested, I am attaching the problematic input DOCX file along with the generated output PDF document for your review. Please check and let me know your findings.
50260_SN IN 25000038.Docx (30.8 KB)

50260_SN IN 25000038.pdf (131.1 KB)

@XECOM The the problem is not reproducible on my side. Here is the output produce on my side:
out_HarfBuzz.pdf (110.4 KB)

Usually, the such problems occur because the fonts used in your input document are not available on the machine where document is converted to PDF. The fonts are required to build document layout. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics. You can implement IWarningCallback to get notifications when font substitution is performed.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/