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

Free Support Forum - aspose.com

Unable to save pdf document to memory stream

Dear Aspose Team,


I am using the below code to read text from a .seq file and trying to write the text to pdf. The pdfdocument is not saving to the memorystream it is taking so much memory.

var text = File.ReadAllText(“00F605756ED231EE2F7A36.seq”);

var section = pdfDocument.Sections.Add();
section.Paragraphs.Add(new Text(text));

var pdfMemoryStream = new MemoryStream();
pdfDocument.Save(pdfMemoryStream);
pdfMemoryStream.Flush();

pdfMemoryStream.Close();

Please download the .seq file from below location.
https://www.dropbox.com/s/3b3cx6lqx7tkowj/00F605756ED231EE2F7A36.seq?dl=0

Thanks & Regards,
N.Murali Krishna.

Hi Murali Krishna,


Thanks for using our API’s.

I have observed that you are using a legacy Aspose.Pdf.Generator approach to convert .seq file to PDF format and this approach is obsolete. We encourage our customers to try using new Document Object Model of Aspose.Pdf namespace. However during my testing with following code snippet, I have observed that an OutOfMemory exception is being generated when converting the file to PDF format. For the sake of correction, I have logged this problem
as PDFNEWNET-39737 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.

[C#]

var text = File.ReadAllText(“c:/pdftest/00F605756ED231EE2F7A36.seq”);<o:p></o:p>

Aspose.Pdf.Document pdfDocument = new Document();

var section = pdfDocument.Pages.Add();

section.Paragraphs.Add(new TextFragment(text));

var pdfMemoryStream = new MemoryStream();

pdfDocument.Save(pdfMemoryStream);

pdfMemoryStream.Flush();

pdfMemoryStream.Close();