Out of memory error while concatenating pdf's

I am trying to concatenate 50 pdf’s in a folder.Below is the code I am used to concatenate.The below programs throws out of memory error.Total PDF size in that folder is around 75 Mb only.Please help to resolve this and Please also let me know upto which file size the PDF concatenation will work fine?

public static void concatPDF(String destination,List convertedFileNames,Map<String,Integer> pdfInfo) throws Exception{
Integer pdfcount=new Integer(0);
PdfFileInfo pdffileinfo=null;
InputStream[] pdfStream=new InputStream[convertedFileNames.size()];
//List pdfStream=new ArrayList();
for(int i=0;i<convertedFileNames.size();i++){
pdfStream[i]=new FileInputStream(destination+convertedFileNames.get(i));
//pdfStream.add(new FileInputStream(destination+convertedFileNames.get(i)));
pdffileinfo=new PdfFileInfo(destination+convertedFileNames.get(i));
pdfInfo.put(convertedFileNames.get(i),pdfcount+1);
pdfcount=pdfcount+pdffileinfo.getNumberofPages();
System.out.println("— PDF Count —"+pdfcount);
}
String outFile=destination+ApplicationConstants.SINGLE_PDF+AppHelper.getFormattedTimeStamp()+ApplicationConstants.pdf;
try {
FileOutputStream outFos=new FileOutputStream(outFile);
PdfFileEditor editor = new PdfFileEditor();
editor.concatenate(pdfStream, outFos);
outFos.close();
//concatPDFs(pdfStream,outFos,true,pdfInfo,convertedFileNames);
bookMarkPDF(pdfInfo,outFile);
}
catch(Exception E){
E.printStackTrace();
}
}

Hi Anand,


Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problem that when trying to concatenate large PDF documents, an exception is being generated. For the
sake of correction, I have logged it in our issue tracking system as
PDFKITJAVA-33214. We will investigate this
issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Hi ,

Could you please update whether the issue has been resolved?

Hi Anand,


Thanks for your patience.

Our development team is working hard on resolving this issue but I am afraid this problem is not yet completely fixed. Nevertheless, I have requested the development team to share any possible ETA. As soon as I have some updates regarding its resolution, I would be more than happy to update you with the status of correction. Please be patient and spare us little time.

We are sorry for this delay and inconvenience.

Hi Anand,


Thanks for your patience.<o:p></o:p>

I have further discussed with development team and as per our current estimates, we plan to get this issue resolved in next release version of Aspose.Pdf.Kit for Java 4.4.0. Please be patient and wait for the new release version and as soon as it becomes available, we would be more than happy to update you with the status of availability.

Your patience and comprehension is greatly appreciated in this regard.

The issues you have found earlier (filed as PDFKITJAVA-33214) have been fixed in Aspose.Pdf.Kit for Java 4.4.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.