PdfFileEditor.concatenate() File Size Issue

We've been running into an issue where the PdfFileEditor.concatenate() method has been throwing exceptions for files larger than a few MB. Originally, it has a Java heap space issue, but after making the neccessary configuration changes we now receive a ClassCastException (caused by code internal to aspose).

I have seen other posts indicating that this issue should have been resolved with the lastest release (4.4) but this does not seem to be the case for us.

This has become a high profile issue to our current application so any help that can be provided would be greatly appreciated.

Hi Jackye,


Thanks for using our products and contacting support.

Recently we have fixed issues related to concatenation of large PDF document however sometimes due to complexity and structure of specific PDF files, an error occur while processing these documents. Can you please share some sample PDF files causing this problem so that we can test the scenario at our end.

We are sorry for your inconvenience.

Forgive the delay, it was difficult to get non-compnay senstive sample files to reproduce the problem.

Anyway, I've attached two PDFs that should reproduce some of our concatenation issues.

Let me know what you come up with.

Hi Jackye,


Thanks for sharing the resource files.

I have tested the scenario using Aspose.Pdf.Kit for Java 4.4.0 over Windows 7 X64 where I have used JDK 1.7_u10 and I am unable to notice any issue. Both PDF files are properly being concatenated. Can you please share some details regarding your working environment.

I have used the following code snippet to test the scenario.

[Java]

try<o:p></o:p>

{

//read the input file

String inFile1 = "c:/pdftest/thouPages.pdf";

String inFile2 = "c:/pdftest/solarcat.pdf";

String outFile = "c:/pdftest/kitOut1.pdf";

FileInputStream inStream1 = new FileInputStream(inFile1);

FileInputStream inStream2 = new FileInputStream(inFile2);

//concatenate two files

FileOutputStream outputStream = new FileOutputStream(outFile);

PdfFileEditor editor = new PdfFileEditor();

editor.concatenate(inStream1, inStream2, outputStream);

//close the output FileOutputStream

outputStream.close();

}

catch (Exception ex)

{

System.out.println(ex.getMessage());

}