NullReferenceException in Aspose.PDF .NET

I have HTML which contains special character & # x FF0C;
And when I try convert this html to pdf I have got exception System.NullReferenceException: Object reference not set to an instance of an object.

Stacktrace:

at #=znwrRRAS4Loo9fctuiUfYkTU3RWRySOC9nONiNXqv9aHX.#=zZHApOV4=(#=zpinPMMz9m3Q_Atu6ZWkW7RE= #=z92u2fJQ=, Boolean #=zPfeWjara7SUX, Boolean #=zjn$q3qM=, Boolean #=zItBMMqA=)
at #=znwrRRAS4Loo9fctuiUfYkTU3RWRySOC9nONiNXqv9aHX.#=zJ_B_errdPtbnD6Kp6g==(#=zVTd$FeAbX5TY7Koh6hwiOzo1P0mDZHSmJQ_Ue9A= #=zmjsmumg=, #=zpinPMMz9m3Q_Atu6ZWkW7RE= #=z92u2fJQ=, Boolean #=zItBMMqA=, String& #=z0cJfK14=)
at #=zfzrBTbmJRnKe2fL4VWGyn1wUE8HsdzNtyrRePbUrtaGxUOAdjDDGFlOoCGiU25BaVdKuF8FGMdmq.#=zD1XZaUUklWUwzTKmwQ==(String #=z_69pzVc=, #=zVTd$FeAbX5TY7Koh6hwiOzo1P0mDZHSmJQ_Ue9A= #=zmjsmumg=, #=zJRoqtKfEX723e63CZPklJyaOPza6cfKWzqjGkQXhrm0jM6zmDe1Worg= #=zDzpcCaY$JvSa, Boolean #=zjn$q3qM=, Boolean #=zItBMMqA=, #=zr7RJvWbSXLtmhnM2gadkP0vYVwYTV4KsB7KbMUPAZwrV #=zjl4htP4=, #=z8uXS5A0od_U3oJGPlal$1nZ5BXKpYZbNfw==& #=zOnB1gQs=, #=zpMVVDrz8JeI4ieFomzDyRGHJAKGYVTeTmgClqNEtoBIv& #=zNb$Le5ARL0Uf, String& #=zNs3xTeFwTIfk)
at #=zmvoHFblCpZ9olTXtw_Ou06NL_Jo$CMs65XG9cGVKZ9ZPa66tQPZoRrg=.#=zTw71ghloEHSUYKpESw==(#=z8JzRwMDnRYyPoUkGXOTktI5GiVn2YHsuOOxxiO8MqEIi1eHeFTF7ysQsCY$MBpxmQYqNzO0QKGMHBsVjfg==[] #=zq0I04CtrT0f_SBmpFvLZ2C06dlKl, String #=z_69pzVc=, #=zVTd$FeAbX5TY7Koh6hwiOzo1P0mDZHSmJQ_Ue9A= #=zmjsmumg=, #=zJRoqtKfEX723e63CZPklJyaOPza6cfKWzqjGkQXhrm0jM6zmDe1Worg= #=zDzpcCaY$JvSa, Boolean #=zjn$q3qM=, Boolean #=zItBMMqA=, #=zr7RJvWbSXLtmhnM2gadkP0vYVwYTV4KsB7KbMUPAZwrV #=zjl4htP4=, #=z8uXS5A0od_U3oJGPlal$1nZ5BXKpYZbNfw==& #=zsyTstQ0=, #=zpMVVDrz8JeI4ieFomzDyRGHJAKGYVTeTmgClqNEtoBIv& #=zNb$Le5ARL0Uf, String& #=zNs3xTeFwTIfk)
at #=zW5Xa4oeC9xkdrg53c7m_9A8GhuQz1Lpg02hZ52oXjEiqESlF2g==.#=zCvNR88VifZ1v(#=z0i_fTIncbOLUtOWxOA_thhXtOsYZyw5u$g== #=zLIhQ5mc=, TextEditOptions #=z4RSMOLM=)
at Aspose.Pdf.Text.TextSegment.set_Text(String value)
at Aspose.Pdf.Text.TextSegment.#=z1HdSNN8=(#=zUr3fyKG1IneV0AIo$ZJrHPyAyAHDlI6R3MYb71h4KnmJ1hTf3SoK36M= #=ziMf_ogsd8w8L)
at Aspose.Pdf.Text.TextBuilder.#=zWEWgl98=(TextFragment #=zFpdfUITBITA9, Int32 #=zgRpXd3U=, Boolean #=zGVPBJOAg$oiM)
at Aspose.Pdf.Text.TextBuilder.AppendText(TextFragment textFragment)
at #=zpTpLRjqzN9LeG6H24FQJlwd1dwN$WwutzQ==.#=zSm38H4M=(String #=zBXx_5Yw=, PointF #=zCalyTNs=)
at #=zHr6FxxV$AvuI40TX0HRoMTMm9Xvb.#=zJdBkcVg=(#=zZeRQoXflmqEKW6KKO2w9SJfliAjmzVTUWA== #=zvVtm58kNoD$E, Boolean #=zOtoa$D3erZ3JRW1x7Q==, #=zuPRGhgmN0ireeEx7gxhEuJcsG_A9wtA1sw== #=zloUOa14=)
at #=zHr6FxxV$AvuI40TX0HRoMTMm9Xvb.#=z$Ld0Cxb6w_0U(#=zfWlGV7dhTUFkybysb8upcVwAqi55rK9z0Q== #=zRWEDIlM=, Boolean #=zOtoa$D3erZ3JRW1x7Q==, #=zuPRGhgmN0ireeEx7gxhEuJcsG_A9wtA1sw== #=zloUOa14=)
at #=zHr6FxxV$AvuI40TX0HRoMTMm9Xvb.#=z_ea$5z9h2fOQddIqqg==(#=ztz0RAVtFtecVMxYyLQ== #=z_8TUeXIrYvb00DZufg==, Boolean #=zOtoa$D3erZ3JRW1x7Q==, #=zuPRGhgmN0ireeEx7gxhEuJcsG_A9wtA1sw== #=zloUOa14=)
at #=zHr6FxxV$AvuI40TX0HRoMTMm9Xvb.#=z02pelOo=(#=zt8_O80gh3xdPBWRrBx9HjwDf99yZQEk6Xw== #=zVj3TBps=, #=zYyBXSocpnRwaYczuqQ== #=z_8TUeXIrYvb00DZufg==, Boolean #=zOtoa$D3erZ3JRW1x7Q==, #=zuPRGhgmN0ireeEx7gxhEuJcsG_A9wtA1sw== #=zloUOa14=)
at #=zSS6lCi_DLrMFAKNs1HOzojOvoSfInKoF5w==.Render(#=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=)
at #=zaZ4P10oCoevFIf6_lOjbMMDm6I0F_EtbUA==.#=znxd4dXySG9jU(#=zm1T4MKNswnStyzEx_M1HibM= #=z3DoW6qx9Gj59CbzAPQ==, #=zBQtzmhV2g5peUos_6H9GcgffiXJC[] #=zIUDoD3$dK6sO, #=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=, TimeSpan #=zkAr74mo=)
at #=zNsafgmWQl1wcQ06tKihRpWx2v06T.Render(#=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=, TimeSpan #=zkAr74mo=, #=zfaIfdJtDQRvobMdYD8Lzai0=[] #=zqEiNdAs=, #=zTZDVyP43YBTW4TSUQsDbxsI=[] #=zZhMPAFc=)
at #=zNsafgmWQl1wcQ06tKihRpWx2v06T.Render(#=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=, TimeSpan #=zkAr74mo=, #=zTZDVyP43YBTW4TSUQsDbxsI=[] #=zZhMPAFc=)
at #=zOx9cjl_bqnKAFAudAofFViq4Igl$.Render(#=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=, #=zlwcN$H4= #=zRl0TbqM=, TimeSpan #=zkAr74mo=)
at #=zOx9cjl_bqnKAFAudAofFViq4Igl$.Render(#=zzTRj_uMXVaq2j6$SvnL89dut1fdF #=znfR1eFI=, #=zlwcN$H4= #=zRl0TbqM=)
at #=zPz9OAGKGJ$FmB7AheNjU0KCjvlep.#=z$WFqHKEbzsEt(Stream #=zQvbq0Adjauwm, Document #=zQTodA5FnwJDU, HtmlLoadOptions #=zZQyn7HJAKgN$, String #=z3woakunCBVob)
at #=zPz9OAGKGJ$FmB7AheNjU0KCjvlep.#=zgwlc4nU=(Stream #=zQvbq0Adjauwm, Document #=zQTodA5FnwJDU, HtmlLoadOptions #=zZQyn7HJAKgN$, String #=z3woakunCBVob)
at #=zPz9OAGKGJ$FmB7AheNjU0KCjvlep.#=zgwlc4nU=(Stream #=zQvbq0Adjauwm, Document #=zQTodA5FnwJDU, HtmlLoadOptions #=zZQyn7HJAKgN$)
at Aspose.Pdf.Document.#=zk4MIQ_o=(Stream #=zGvFHhT8=, LoadOptions #=z4RSMOLM=)
at Aspose.Pdf.Document…ctor(Stream input, LoadOptions options)

Html:

<!doctype html>
html lang=“en”
head
meta charset=“utf-8”
/head
body
div style=“display: flex; justify-content: space-between;align-items: flex-start;”
div
/div
/div
table
tr
th Comment /th
/tr
tr
td T & #xFF0C; month /td
/tr
/table
/body
/html

Runtime: mcr.microsoft.com/dotnet/aspnet:6.0.16-bullseye-slim
Version: PackageReference Include=“Aspose.PDF” Version=“23.5.0”

@NikitaEgorov

Would you kindly share the environment details e.g. OS Name and Version which you are using? Also, can you please share the code snippet as well? Please also try using Aspose.PDF.Drawing from NuGet Gallery instead of Aspose.PDF and let us know if issue still persists.

docker image mcr.microsoft.com/dotnet/aspnet:6.0.16-bullseye-slim
PackageReference Include=“Aspose.PDF” Version=“23.5.0”

@NikitaEgorov

It looks like the issue is related to missing fonts. Can you please try to install the msttcorefonts package as well and try again? Please also try using Aspose.PDF.Drawing from NuGet Gallery instead of Aspose.PDF and see if it resolves the issue.

I changed package to Aspose.Html :grin:

@NikitaEgorov

If you are able to resolve your issue using Aspose.HTML, its a good news. However, please do try the suggestion that we shared above for Aspose.PDF and let us know in case issue still persists. We will surely address it.