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

Free Support Forum - aspose.com

OutOfMemory error on saving large document as PDF

Hi,

We are mail merging letters and then saving in PDF format. Normally this works fine, but the following line results in a System.OutOfMemoryException error when the document has around 2,000 letters or more (3 pages per letter = around 6,000 pages):

document.Save(fileName, SaveFormat.Pdf)

The server in question has 40GB of RAM.

The stack trace is as follows:

   at     . (      ,       , Boolean  , Boolean  ,  
     , Node  
,       )
   at     . (Node  , Int32  , Boolean  ,  
     )
   at     . (Node  )
   at  
   . (Node  )
   at     . 
()
   at     . ()
   at     . ()
   at Aspose.Words.Document.UpdatePageLayout()
   at     . (      ,       )
   at     .         (      )
   at    .        (      )
   at Aspose.Words.Document. (      )
   at Aspose.Words.Document. (Stream  , String  , SaveOptions  )
   at Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)

Most of the stack trace seems to be unprintable characters.

We are working around this issue by re-generating the letters in batches of 1,000.

This is Aspose.Words for .NET v21.4.

Thanks

@cellardoor,

Please upgrade to the latest (21.7) version of Aspose.Words for .NET and see how it goes on your end? In case the problem still remains, then please compress the following resources into ZIP format and attach the .zip file here for testing:

  • Your simplified template Word document
  • Please also create a standalone simplified Console Application (source code without compilation errors) that helps us to reproduce this problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.
  • Any other related file containing the data for mail merge

As soon as you get these pieces of information ready, we will then start further investigation into your issue and provide you more information.