Hello,
We have been using Aspose.Words for about a year without issue. However, we have a need to take a word document and mail merge about 10,000 records and then we stream it as a PDF. The end result is a PDF with 10,000 pages all mail merged. When we try to do this, we get OutOfMemory errors every time. I’m guessing because the size of the document is too large. However, is a 10,000 page document really too large? I tried reducing it to 6,000 pages with the same Out of Memory error results.We have fairly decent test servers with 8GB RAM, so I’m fairly confident that it should be able to handle it.
We are using ASP.NET and we are simply building a DataTable with 10 columns and 6,000 rows of data. Then we call it as follows:
Dim dt as new DataTable(“OSHA300”)
.
…
. populate dt with sql select query (ex: select StoreNo, City, State, Zip FROM Store). This returns about 6,000 reocrds.
Dim doc As New Document(“C:\OSHA300A.DOCX”)
doc.MailMerge.Execute(dt)
doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveUnusedFields
doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveUnusedRegions
doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveEmptyParagraphs
doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveContainingFields
I’m looking for a solution to this issue. The Out of Memory errors are not good as this is probably doing more harm to the server than we know. Here are my questions:
1) Has anyone had this issue before and how did you correct it?
2) Is it possible to merge 200 records at a time and process the document in chunks? Basically, merge the first 200 records, create a PDF, then process the next 200 records, and append them to the original PDF, etc… then stream the final PDF to the browser? Or would streaming a large PDF cause the same out of memory issues?
3) I’ve attached our word doc to this forum if it helps in recreating this issue.
Any help would be greatly appreciated as we need to decide if we should continue with Aspose.Words or start looking for a new solution.
Thanks,
Brian