We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Non-English Issue

Hi,

We are using Aspose.Pdf version 19.1.0 from .Net core which is getting deployed in Pivotal Cloud Foundry (PCF) cloud environment on window stack.

Below line is throwing exception when we try to set Non-English(Fr) content like “Date d’arrivée prévue”

var deliveryLblTextFragment = new TextFragment { Text = DeliveryLabel };

Exception:
System.NullReferenceException: Object reference not set to an instance of an object. -> at Aspose.Pdf.Text.Font…ctor(#=zm4ZaUF5F$GibfVvok$IgEPU= #=zVKSTUmg=) -> at #=z7OYuAG6f2B6JknBGFTA5vMZRFpxot7QQWJMkixxnin_FQK5PaI1nanU=.#=zwt_CRAF3UuDfUwbQSoRXQvF1QElL(String #=zobqwNAk=, Font #=zVKSTUmg=, Font& #=zDpnr0LKhS24IaK47Kr5WUrY=) -> at Aspose.Pdf.Text.TextSegment.set_Text(String value) -> at Aspose.Pdf.Text.TextFragment.set_Text(String value)

Note: same code works on my Laptop with window OS, but when deployed on PCF cloud environment it is not working.

Now since it is PCF cloud environment we can’t install the fonts on the container, how to resolve this Non-English issue?

Regards
-Nirmal

@nirmalkumarcm,

Thank you for contacting support.

I like to inform that you are using very old version of Aspose.PDF and I request you to please use latest version of Aspose.PDF 20.3 and if there is still an issue than please share source files along with sample project to further investigate this issue.

Hi,

I have upgraded to 20.3 version of Aspose.Pdf for .NET
Still having same issue.

Below is actual code:

public MemoryStream GeneratePdfPoc()
{
var table = new Table();
var hdrRow = table.Rows.Add();
var hdrRowCell = new Cell();

        try
        {
            hdrRowCell.Paragraphs.Add(new TextFragment { Text = "Date d’arrivée prévue" });
        }
        catch (Exception ex)
        {
            table.ColumnWidths = "100%";
            hdrRowCell.Paragraphs.Add(new TextFragment { Text = $"TextFragment had exception : {ex.ToString()}" });
        }

        hdrRow.Cells.Add(hdrRowCell);

        SetAsposePdfLicense();

        var document = new Document();
        var page = document.Pages.Add();
        page.Paragraphs.Add(table);

        var output = new MemoryStream { Position = 0 };
        document.Save(output);

        return output;
    }

PDF ran from PCF Could environment on Window operating system: image.png (203.7 KB)

PDF ran from Local Visual studio on Window operating system : From_Local_Visualstudio.pdf (31.8 KB)

@nirmalkumarcmAspose,

I have worked with sample code shared by you and it seems that issue is with fonts. Can you please check and make sure that required fonts are available in your deployment version.