0

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();
            }
        }
    }
John_sl
  • 29
  • 3
  • 1
    Have you checked the size of the generated PDF, by saving it to a file? Is it actually too big for your memory? – gnud May 05 '21 at 22:14
  • @gnud yeah, it is big file size. but cant we use PdfDocumentProcessor in order to save it to a memory stream? – John_sl May 05 '21 at 22:41
  • what is your httpRuntime maxRequestLength value? might be the problem you can find this in the web.config had the problem with my Xtrareports – Eric May 06 '21 at 19:06

0 Answers0