Hello,
For my PDF document generation I am using a font that is an embedded resource in my app
//_fileProvider is a reference to a EmbeddedFileProvider
using var fontStream = _fileProvider.GetFileInfo(“Fonts\arial.ttf”).CreateReadStream();
var font = Aspose.Pdf.Text.FontRepository.OpenFont(fontStream, FontTypes.TTF);
font.IsEmbedded = true;
Then I create a Document with a Page like this:
var document = new Aspose.Pdf.Document();
var page = document.Pages.Add();
Then I create a Table like this:
var table = Aspose.Pdf.Table();
var row = table.Rows.Add();
row.DefaultCellPadding = new MarginInfo
{
Top = 0f,
Left = 0f,
Right = 0f,
Bottom = 2f
};
row.DefaultCellTextState.FontSize = 8f;
row.DefaultCellTextState.Font = font;
row.DefaultCellTextState.FontStyle = FontStyles.Regular;
row.DefaultCellTextState.LineSpacing = 2f;
row.Cells.Add(“VrtiČ”);
When I run this code in IIS on Windows the code works fine.
When I run this code in NGINX on Linux the last line generates a NullReferenceException with the following stack.
System.NullReferenceException: Object reference not set to an instance of an object.
at Aspose.Pdf.Text.Font…ctor(#=z2brvLsOKU772tRJv5nQEY_o= #=zL7p1K7g=)
at #=z0LKTtCfNFYTWtiha0GmMxsPWHSGDoLQUBL311LNbSF8hcdobGnd_13o=.#=zoY8bJDEpkTHw7OIy7BwM6BmTkzWD(String #=zvcoqJJY=, Font #=zL7p1K7g=, Font& #=zfygFRaU61fCpXsYGsKi8giY=)
at #=zuZzeULMWwmzG_nVT$0Q$jFjIl3Im.#=zVCtQ7t_Me_9B(String #=zGYILGEQ=)
at Aspose.Pdf.Text.TextFragment.#=zkF46K6LQJs03(String #=zGYILGEQ=)
at Aspose.Pdf.Text.TextFragment…ctor(String text)
at Aspose.Pdf.Cells.Add(String text)
When I change the line to row.Cells.Add(“VrtiC”) the code works fine on both Linux and Windows.
I think the problem is the rendering of the a special character ‘Č’ on Linux?
Is this a known problem and can you please propose a solution?