Hi,
We are using Aspose.Pdf for .NET version 20.3 which is getting deployed in Pivotal Cloud Foundry (PCF) cloud environment on window stack/os.
Below line is throwing exception when we try to set Non-English(Fr) content like “Date d’arrivée prévue”
new TextFragment { Text = “Date d’arrivée prévue” }
Exception:
TextFragment had exception : System.NullReferenceException: Object reference not set to
an instance of an object.
at Aspose.Pdf.Text.Font…ctor(#=zaCT$kc$RUo7Q4ubUn4tXiRE= #=zs3EEYEc=)
at
#=zKzeu6yEv9nebofO9$xNNnxVk59hmUl$dcwCk4i$5qbfH8yuPRlVnjLw=.#=z_6504JuWeG_
2TMuRGTlg1WgQliBv(String #=zgDhrh1s=, Font #=zs3EEYEc=, Font&
#=zbMM2MfSEpOCkp8xkvxZxf4M=)
at Aspose.Pdf.Text.TextSegment.set_Text(String value)
at Aspose.Pdf.Text.TextFragment.set_Text(String value)
at
Dell.SupportOnline.Orders.Export.Pdf.PackingSlip.PackingSlipPdfGenerater.GeneratePdfPoc
Sample 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;
}
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?
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)
Regards
-Nirmal