I have tried a code for saving large-sized PDF documents on a memory stream using a PdfDocumentProcessor from devExpress. But when the file size is too large it gives an error like System.OutOfMemoryException. The sample code snippet is shown below. please help me to resolve this problem.
public byte[] MergeToBytes()
{
using (var processor = new PdfDocumentProcessor())
{
AppendStreamsToDocumentProcessor(processor);
using (var newDocument = new MemoryStream())
{
processor.SaveDocument(newDocument); // this line gives memory exception
return newDocument.ToArray();
}
}
}