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

Free Support Forum - aspose.com

Concatenated pdf is too large


I am using Aspose.Pdf.Kit in product version 2007.10.08, file version

When I concat e.g. three pdf documents of size:
1/ 43 kB
2/ 34 kB
3/ 74 kB
1 + 2 + 3 will be 151 kB of aprox. expected size of the concatenated pdf.
But the size of the concatenated pdf is 256 kB.
When I concat e.g. five files of sum size of 600 kB then I get 1 MB file after concatenation.

- why is the concatenated file larger then expected?
- can this increase in size after concatenation of pdfs be avoided?

Thank you!
Kind regards, Daniel Dusek

Code I use to concatenate the pdfs:

private byte[] ConcatenatePdfDocuments(IEnumerable documents)
var notEmptyDocuments = documents.Where(d => d.PDF.Length > 0);
var outStream = new MemoryStream();
_pdfEditor.Concatenate(notEmptyDocuments.Select(document => new MemoryStream(document.PDF)).ToArray(), outStream);
var buffer = outStream.GetBuffer();

return buffer;

The function receives pdf documents as byte array, creates one memory stream from those byte arrays and calls the Concatenate method of Aspose.Pdf.Kit.

Hi Dan,

We have introduced a merged version Aspose.Pdf for .NET 6.0.0. Could you please download and try it at your end? You can use the same code by including the namespace Aspose.Pdf.Facades, as it corresponds old Aspose.Pdf.Kit. If it still doesn’t resolve your issue then please share the input PDF files with us, so we could investigate the issue at our end and guide you accordingly.

We’re sorry for the inconvenience.

Hi Shahzad,

thank you for quick reply!

Unfortunatelly the new version of Aspose.Pdf for .NET 6.0.0 would require new licence right? We have aspose total licence, but the code I use to set the licence file does not work for the new version … so we will have to buy a new licence and to get it will take some time in my company. But I need the solution right now.

Is there another possibility how to achieve smaller pdf after concatenation with version which I am currently using?

Kind regards, Dan Dusek

Hi Dan,

If your license is not expired then you can use either Aspose.Pdf for .NET or Aspose.Pdf.Kit for .NET license with the merged Aspose.Pdf for .NET. However, if the license is expired then you’ll have to renew the license to use the latest version. Nevertheless, you may get a temporary license for 30 days and try the latest version at your end.

I hope this helps. If you have any further questions, please do let us know.