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

Free Support Forum - aspose.com

PdfFileEditor.Concatenate Producing Corrupt PDFs

We are running into a problem with PdfFileEditor.Concatenate(string[], string) producing corrupt PDFs when we use FileProcessingStrategy.OptimizeMemoryUsage, if multiple merges are taking place at the exact same time (separate threads using separate PdfFileEditor instances).

Is this a known issue? Is there a workaround?

I can supply sample code to demonstrate the issue if necessary.


Hi Terry,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

To regenerate the issue at our end, please share your sample code (or a sample application) with your template PDF files with us. This will help us identify the issue soon.

Thank You & Best Regards,

Attached is the sample Visual Studio 2010 project (not including the Aspose dll due to file size). It is set to combine the 12 documents in the SourceDocuments folder into batches of 2, resulting in 6 combined PDFs. I have left the output from a previous run in the Output folder. On these smaller batches, it seems to either work or output 0 bytes. On larger batches (100, 500) of larger source PDFs, it is more common to see truncated result files.

Since it’s a threading issue, it doesn’t happen every single time, but on this small sample set it’s happening about 4 out of 5 times for me.

Adjust the sourceFolder variable in the code to point to the directory with sample documents. Documents are expected to be numbered 1.pdf, 2.pdf, etc.

Also adjust the outFolder variable to specify where the Combined_n.pdf files will be output.

Hi Terry,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample application and template and output files.

I tested your scenario with the latest version of Aspose.Pdf for .NET v6.6 and I did not find any issue. The resultant files are generated properly. Please download and try the merged Aspose.Pdf for .NET and see if it works fine for you too. As you are using Aspose.Pdf.Kit for .NET, I would like to mention that Aspose.Pdf.Kit for .NET has been discontinued as a product and all its features are merged into Aspose.Pdf for .NET (under Aspose.Pdf.Facades namespace). You may check the following links to simply convert your code from Aspose.Pdf.Kit to Aspose.Pdf for .NET.



Please feel free to contact support in case you have any further query.

Thank You & Best Regards,