Hi Eric,
In order to optimize memory utilization and avoid any memory spikes, you'll have to modify the code according to the new mechanism introduced in Aspose.Pdf.Kit for .NET 4.2.0. Please see the following code snippet:
string[] files = new string[10001];
files[0] = "AP1099.pdf";
for (int i = 1; i < 10001; i++)
files[i] = "AP10992.pdf";
PdfFileEditor editor = new PdfFileEditor();
FileProcessingStrategy strategy = Settings.Strategy;
Settings.Strategy = FileProcessingStrategy.OptimizeMemoryUsage;
editor.Concatenate(files, "result.pdf");
Settings.Strategy = strategy;
In this code, instead of using the memory streams we have used files. So, if you want to concatenate a large number of files then please make an array of all these files and use the code as suggested above. You can also see that we have used OptimizeMemoryUsage option for the optimal use of the memory. Please note that this option can only be effective if you use it with an array of files, whereas if you concatenate individual files in the loop then it won't help. Also, it is not effective in evaluation mode.
Please try to modify your code as suggested above and see if it helps in your scenario. We would really appreciate if you share the results with us.
We're sorry for the inconvenience and looking forward to help you out.
Regards,
Shahzad Latif - [
Follow me on Twitter!]
Support Developer/Developer Evangelist
Aspose Sialkot Team
Aspose - Your File Format Experts
Keep in touch! We're on
Twitter and
Facebook