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

Free Support Forum - aspose.com

Unable to Merge 70000 pdf files into single PDF using aspose

Hello Aspose Team,

Can some help me to get out of below issue.

Unable to Merge 70000 pdf files into single PDF using aspose.

Thanks in advance.
Siva

@siva0468,

Please send all details of the scenario, including source PDF documents, code and the problematic behavior of the API. We will investigate your scenario in our environment and share our findings with you. Please note, you can ZIP all files, and then upload into the post. There is an upload button in the header of the post editor. However, if the size of ZIP file is more than 3MB, then please upload to any free file sharer server, and share its download URL.

Thanks for quick reply imran.

Please find sample application in below url to test it out.

https://drive.google.com/file/d/1-jtc65-mNFifUzTyIuHuC7-jeHy00uW2/view?usp=sharing

Please let us know if you need more information for your analysis.

@siva0468,

We are working over your query and will get back to you soon.

Thanks for Update.

@siva0468,

Please try the code as below, and then let us know how that goes in your environment:
C#

string sourceDir = @"C:\Pdf\test827\ConsoleApplication3\ConsoleApplication3\TestPDFFile\Sample.pdf";
string destinationDir = @"C:\Pdf\test827\ConsoleApplication3\ConsoleApplication3\TestPDFFile\";
for (int k = 0; k < 70000; k++)
{
    File.Copy(sourceDir, destinationDir + "pdffile_" + k + ".pdf");
}
List<string> lstDocs = Directory.GetFiles(@"C:\Pdf\test827\ConsoleApplication3\ConsoleApplication3\TestPDFFile\").ToList();
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(lstDocs[0]);
for (int i = 1; i < lstDocs.Count; i++)
{
    Aspose.Pdf.Document document = new Aspose.Pdf.Document(lstDocs[i]);
    // Add pages of second document to the first
    pdfDocument.Pages.Add(document.Pages);
}
pdfDocument.Save(@"C:\Pdf\test827\Output.pdf", SaveFormat.Pdf);

Hello I have programmed same code but i am getting “System Out Of memory exception” looks like merge of pdf files using more ram space.

How can we avoid this issue.

System Config : 8 GB Ram, win 10

@siva0468,

The total size of all PDF documents is 7.2 GB, and Aspose.PDF API requires a bit more memory to process all these documents. The 8 GB RAM is not enough.