Hi, we are using using Aspose.PDF.Drawing 23.12.0 with a license, but the issue was also reproduced with the same code with the latest release (trial).
The issue shows itself when running the .net core 8 application either on a linux container or directly on the WSL through Visual Studio. On Windows, the code does not fail.
Code to reproduce:
using Aspose.Pdf;
using Aspose.Pdf.Text;
FontRepository.LoadFonts();
var document = new Document();
var page = document.Pages.Add();
// 1. text
page.Paragraphs.Add(new TextFragment("1.1 Some text"));
// 2. text with newline
page.Paragraphs.Add(new TextFragment("2.1 Some text" + Environment.NewLine));
// 3. text with norwegian characters
page.Paragraphs.Add(new TextFragment("3.1 Some text æ"));
page.Paragraphs.Add(new TextFragment("3.2 Some text ø"));
page.Paragraphs.Add(new TextFragment("3.3 Some text å"));
page.Paragraphs.Add(new TextFragment("3.4 Some text æøå"));
// 4. text with norwegian characters before newline
page.Paragraphs.Add(new TextFragment("4.1 Some text æ" + Environment.NewLine));
page.Paragraphs.Add(new TextFragment("4.2 Some text ø" + Environment.NewLine));
page.Paragraphs.Add(new TextFragment("4.3 Some text å" + Environment.NewLine));
var stream = new MemoryStream();
document.Save(stream, SaveFormat.Pdf);
File.WriteAllBytes("#output.pdf", stream.ToArray());
If the last line adding a paragraph is removed, the PDF is generated just fine. With the last line, the following error is thrown:
Object reference not set to an instance of an object.
at aspose.pdf.text.font..ctor(#=zjuhsxkwul6jhk3l0j8ft3xs= #=zsoy5qye=)
at aspose.pdf.text.textparagraph.#=zwajerq8eivvmmovdcunwhaa=(string #=zznhkzlc=, textstate #=zoucxtqm=)
at aspose.pdf.text.textparagraph.#=zwrhbpcqf5ipr(textfragment #=zznhkzlc=, textstate #=zoucxtqm=, single #=z3zaxe8jkf7ud)
at aspose.pdf.text.textparagraph.#=zxsebtcabhv_8cymk4omtlo8=(textfragment #=zos0pkwu=, textstate #=zoucxtqm=, single #=z3zaxe8jkf7ud)
at aspose.pdf.text.textparagraph.appendline(textfragment line, textstate textstate, single linespacing)
at aspose.pdf.text.textparagraph.appendline(textfragment line)
at #=znr6d2gv41z6ha5orklpp5ig=.#=zyl16smkqkul_(textfragment #=zos0pkwu=, rectangle #=zc$effj0=, page #=zipbugsq=, boolean #=zwkeu2r7i1rs9, horizontalalignment #=zas7gkso=, verticalalignment #=z_ohmfqjina5q, boolean #=zx$cji1jssgjk)
at #=znr6d2gv41z6ha5orklpp5ig=.#=zyl16smkqkul_(textfragment #=zos0pkwu=, rectangle #=zc$effj0=)
at #=znr6d2gv41z6ha5orklpp5ig=.#=zfamhzisqkbrx(textfragment #=zeaf2wvd0ittgkl9lmg==, textbuilder #=zp5suv4w=, textparagraph& #=zyv2axxdduypc)
at #=znr6d2gv41z6ha5orklpp5ig=.#=zii7wbnpeln7u(textfragment #=zeaf2wvd0ittgkl9lmg==)
at #=znr6d2gv41z6ha5orklpp5ig=.#=zd6clvug=()
at aspose.pdf.page.#=zdippncgqxgis(page #=zipbugsq=, list`1 #=zgnow9w8=, double #=zwewyrao=, double #=zrafgwu4=)
at aspose.pdf.page.#=zzppvjzw=(page #=zipbugsq=)
at aspose.pdf.page.#=zxowrqq3id1x9z0wygq==()
at aspose.pdf.document.processparagraphs()
at aspose.pdf.document.#=zbwdxfkdcnsil(stream #=z9ru6u4u=, saveoptions #=zjpioeihlzoct)
at aspose.pdf.document.#=zsrvdau0yswub(stream #=zl7sc4wlehaqh, saveoptions #=zjtjhevc=)
at aspose.pdf.document.#=zsrvdau0yswub(stream #=zl7sc4wlehaqh, saveformat #=zicsq9rm=)
at aspose.pdf.document.save(stream outputstream, saveformat format)