saving a large size PDF Document to a memory stream using a PdfDocumentProcessor

921 Views Asked by At

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();
            }
        }
    }
0

There are 0 best solutions below