The root object missing or invalid in .net WebAPi

I am trying generate a pdf using on fly memory as mentioned below.

  1. public static MemoryStream OutPutMObje = null;
    2.OutPutMObje = new MemoryStream(bytesToWrite);
    3.Aspose.Pdf.Document doc = new Aspose.Pdf.Document(OutPutMObje);

at line 3 i am getting the above error and “bytesToWrite” data is fecthed from data and this saved in DB as “varbinary” format
I had a aspose licence as well and if i use physical path no issues with this code.Currently i m using dll version 18.X
Please help on resolving the isssue

@syedbashur

Thank you for contacting support.

We would like to request you to share a narrowed down sample application reproducing this issue, along with necessary source file(s). In case the attachments exceed 3MB size limit, you can upload requested data to any file sharing server like Google Drive, Dropbox etc. and share the download link with us. So that we may try to reproduce and investigate it in our environment. Furthermore, before sharing requested data, please ensure using Aspose.PDF for .NET 18.4 in your environment.

Thank you so much Farhan Raza,TestFile.zip (115.1 KB)

Please find the attached zip fileUploading…

i am using 18.4 dll

@syedbashur

We are unable to use the code snippet shared by you, in our environment as it includes few undefined or unknown variables. Kindly share a narrowed down sample project which reproduces the problem reported by you. So that we may reproduce and investigate it in our environment to help you out.