Hi Team,
we are facing issue while merging large pdf files , count is 10. Each file size around 1 GB and we need to merge into single pdf file. Final pdf will be around 10 GB.
we have tried two approaches"
AllpdfFilesCollection = new List();
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\1.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\2.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\3.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\4.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\5.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\6.pdf”);
AllpdfFilesCollection.Add(@“D:\Main\ServiceTier\BatchPrintApplication\pdf\7.pdf”);
string _tempfinalfile = directory + "FINAL_PDF" + "_" + DateTime.Now.Date.ToString("d").Replace("/", "_") + "tempFinalFile.pdf";
aspPDF.Document pdfDocument = new aspPDF.Document();
aspPDF.Document pdfDocument2 = null;
for (int i = 0; i < AllpdfFilesCollection.Count; i++)
{
string path2 = AllpdfFilesCollection[i];
pdfDocument2 = new aspPDF.Document(path2);
pdfDocument.Pages.Add(pdfDocument2.Pages);
pdfDocument2.Dispose();
}
pdfDocument.Save(_tempfinalfile);
pdfDocument.Dispose();
bool isSucceed = pdfEditor.Concatenate(filesArray, _tempfinalfile);
Note : filesArray collection of files
We are getting error : Exception of type ‘System.OutOfMemoryException’ was thrown.