We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert Text to PDF inside Linux Container using Aspose.PDF for .NET - System.NullReferenceException

The text to pdf conversion fails in Linux containers executing it. I am getting the below exception during the save method to a memory stream.
This is happening only for some of the text files. The same files works without a problem locally on a windows machine running the same process.

“exceptions”: [
“Depth”: 0,
“ClassName”: “System.NullReferenceException”,
“Message”: “Object reference not set to an instance of an object.”,
“Source”: “Aspose.Pdf”,
“StackTraceString”: " at #=zTfFVCF2X5NTH8zs5VZ5GOJiQwih$rM2OkQYdxODLwcr0LDh9h40afjk=.#=zh6KShE4=(#=zN0rxLZ0nC$n7nts4RfcoBwbGF$Wr1Bm4MItabqMYaXhU #=zgX3z5z74rPwj)\n at #=zRMjdLi$0x6oAw08qE5aSmGKs_reXyJIoM15ndpjjuR780kixMZ3VxdiGNmQVTGYSBb5gBo$JjFCF.#=z8WsaBvU=(String #=zL9TUpUI=, #=zv5h22hZBZa0Qt9X$mg9EMezdGpMCvc$6egjsC0s= #=zKdMFzYI=, #=z3NJn0rgKZdfKwcCHUdmeHLStjEcqhcf3nFo2lkZsjcxHGji_0CiDJeo= #=zUi9_8D3WrxHn, Boolean #=z9tIXg1I=, Boolean #=zzekXLYM=, #=zrrmtqPXGQ68Qo3M6ugq8OGXFg0AAxZTRWw==& #=zvHgiDd8=, #=zN0rxLZ0nC$n7nts4RfcoBwbGF$Wr1Bm4MItabqMYaXhU& #=zgX3z5z74rPwj, String& #=zm8osaFgYOL4t)\n at #=zTfFVCF2X5NTH8zs5VZ5GOJiQwih$rM2OkQYdxODLwcr0LDh9h40afjk=.#=zuRghSeQ=(#=ztxquhYRowjnsZQxP8GiFPre_Z2LB1ABQGi$YL0IqruX7p2gDDYNAEo6F9fbQqpgIw2g43Z8UA0wz8_mwXg==[] #=z9lUP0kZ88ybKv_G$nW5FxCszA_wI, String #=zL9TUpUI=, #=zv5h22hZBZa0Qt9X$mg9EMezdGpMCvc$6egjsC0s= #=zKdMFzYI=, #=z3NJn0rgKZdfKwcCHUdmeHLStjEcqhcf3nFo2lkZsjcxHGji_0CiDJeo= #=zUi9_8D3WrxHn, Boolean #=z9tIXg1I=, Boolean #=zzekXLYM=, #=zrrmtqPXGQ68Qo3M6ugq8OGXFg0AAxZTRWw==& #=zF66IDKo=, #=zN0rxLZ0nC$n7nts4RfcoBwbGF$Wr1Bm4MItabqMYaXhU& #=zgX3z5z74rPwj, String& #=zm8osaFgYOL4t)\n at #=zUDZ7HicfZW1sPoMeiiKDd8Racvf5qWgdX7pElZ9H1VzoABYGyg==.#=zOh3vn00E9H1_(#=ziElyRjxQoZP7D2p_niN78Et7Febn6bt1VA== #=zFIJhlDw=, TextEditOptions #=zdXGS2ks=)\n at Aspose.Pdf.Text.TextSegment.set_Text(String value)\n at Aspose.Pdf.Text.TextSegment.#=znv8iGFI=(#=zH7ccyGbxhZj8jJl9LKSppjcsfZS1K1h4igQvBaueyEnVbIiOcDYs44w= #=ztND2OgiSSt9_)\n at Aspose.Pdf.Text.TextBuilder.#=z6DFBNs8=(TextFragment #=zO_LTjQN_tjg7, Int32 #=z59xWQKk=, Boolean #=z8YhUjVGnqpBW)\n at Aspose.Pdf.Text.TextBuilder.#=ziFU$pqd$4wXX(TextParagraph #=z9WWekgNF1mLv, Int32 #=z59xWQKk=)\n at Aspose.Pdf.Text.TextBuilder.AppendParagraph(TextParagraph textParagraph)\n at #=zf3mh4BU_114mamWnDbCZ6Oc=.#=zPslNNcObIj2z(BaseParagraph #=zETHvKby0_j2EQtnD1A==)\n at #=zf3mh4BU_114mamWnDbCZ6Oc=.#=z9q7UCkE=()\n at Aspose.Pdf.Page.#=zFzu0M34=(Page #=z$TZFzdk=)\n at Aspose.Pdf.Page.#=zMGYQYQihhLdqVTvu2w==()\n at Aspose.Pdf.Document.ProcessParagraphs()\n at Aspose.Pdf.Document.#=z$evOpM9P92z1(Stream #=z8oKueQA=, SaveOptions #=zFi88sNxJ4rGI)\n at Aspose.Pdf.Document.Save(Stream output)\n at FnDocs.Web.Viewer.Repository.CreatePdf.ToBytes(Document document) in /src/src/FnDocs.Web.Viewer.Repository/CreatePdf.cs:line 89\n


Thank you for contacting support.

Would you please share SSCCE code and source file as ZIP so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.11.

The application is a .Net core WebApi running on a kubernetes cluster docker container hosted on a Redhat Enterprise Linux server.
Here’s the details of hosting OS.
VERSION=“19.04 (Disco Dingo)”
PRETTY_NAME=“Ubuntu 19.04”
UBUNTU_CODENAME=discoAspose.Sscce.WebApi.zip (7.3 KB)


Thank you for sharing requested data.

We have logged a ticket with ID PDFNET-47324 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi Farhan,

Thank you for taking up the issue for resolution. Do you guys have a timeline on addressing this issue?



Please note that the issue has been logged under free support model and will be investigated on first come first serve basis. Therefore, it may take few more months to resolve. As soon as we have some definite updates regarding ticket resolution, we will let you know.

However, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

My thread labeled “Use Aspose.PDF for .NET on Kubernetes with .NET Core 3.1 to generate PDF files*” turns out is throwing this same exception.

In my case I am implementing the PdfFileEditor.Concatinate using a list of MemoryStreams as input and a MemoryStream as output. This same code working under 3.1 Core… but not under a container, either Debian or Alpine.

         using (MemoryStream targetStream = new MemoryStream())
                bool result = pdfEditor.Concatenate(allStreams, targetStream);

            targetStream.Position = 0;
                _logger.LogInformation("Merge Result :" + result);


We have updated the information provided under the logged ticket according to your post. We will surely consider it as well during issue investigation and keep you informed with the status of its rectification. Please spare us some time.

We are sorry for the inconvenience.

Checking in … any updates ?


Regretfully there are no updates regarding issue resolution yet. We have recorded your concerns and will surely let you know as soon as some updates are available. Please spare us some time.

We are sorry for the inconvenience.

Is there any plan to address this issue?


We are afraid that previously logged ticket is not yet resolved as investigation against it is not done. We will surely post an update here as soon as we make some definite progress towards its resolution. Please give us some time.

We are sorry for the inconvenience.