PDF Fails to Load in Linux Container

Hello,

I’m having an issue when trying to obtain the string Content of a loaded PDF within a linux container on Azure:

System.NullReferenceException: Object reference not set to an instance of an object.
  Stack Trace:
      at i..(PdfFontFace )
   at `2..( , Boolean )
   at `2.[TArg]( , Func`3 , TArg )
   at `2.( , Func`2 )
   at i.(PdfFontFace , & , & )
   at i..ctor(IEnumerable`1 , PdfTextOptions , PdfMatrix , StringBuilder , IList`1 )
   at GemBox.Pdf.Content.PdfTextContent.(StringBuilder )
   at GemBox.Pdf.Content.PdfTextContent.ToString()

The code runs locally on both Windows and Mac, but when attempting to run tests against it in Azure, it runs into the above error.

I was under the impression that if GemBox could not find the font for the PDF, it would use a default font, so I’m not sure what would be causing this null reference exception.

We have attempted to use both implementations as specified in the doc here:

Both of which fail with the same error above at

page.Content.ToString()

and

(PdfTextContent)contentEnumerator.Current

I would like to attach the example PDF, however the image uploader rejected it as it’s not in the list of accepted file formats.

For reference, we are on .NET8.0, and are leveraging GemBox.Pdf v2025.3.107, but have also tested with v2025.5.103 with the same results.

Hi Nav,

Please send us a small Visual Studio project (together with your PDF) that reproduces the issue so we can investigate it.

You can send it to us via email or a support ticket, see the Contact page.

Regards,
Mario

Hi Mario,

Thanks for the reply and I apologize for getting back to you late - we ended up circumnavigating the issue by using GemBox.Document instead of GemBox.pdf to load it.