Merge PDF out of memory exception


We are using Aspose.pdf v19.2 library to merge PDF files. We found it will through out of memory exception when merging a 600MB PDF file with other pdf. Our machine is Win10 i3 with 3GB memory.

Here’s our code:
// Open first document
Document pdfDocument1 = new Document(“Concat1.pdf”);
// Open second document
Document pdfDocument2 = new Document(“Concat2.pdf”);

// Add pages of second document to the first

// Save concatenated output file

Here’s our test file:

FYI, we used Adobe Arcobat X Pro to merge the pdf file and it won’t throughout the memory exception.

Please have a look. Thanks.


Thank you for contacting support.

We have worked with the data shared by you and concatenated it with a small PDF document. The process consumed around 2 GB of memory in about 3.5 minutes without any exception with Aspose.PDF for .NET 19.3. Would you please share your observations regarding memory and time consumption with Adobe Acrobat that works fine in your environment.

Here’s our system info:
image.jpg (80.3 KB)

Here’s another PDF file that we are merging it with the 600MB file

Notes, it will take around 1.23min to merge the two pdfs and then through out of memory exception. It will occupy 374MB memory.


We have tried to concatenate both files shared by you and it has now consumed about 5 minutes and more than 2GB of memory before program finishes successfully. Please try to execute the code in x64 Debug Mode and then share your kind feedback with us.