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

Free Support Forum - aspose.com

Compress concatenated document?

Im using the following code to concatenate a bunch of documents using streams

//Create a list of streams to the input documents

List<FileStream> inputStreamList = new List<FileStream>();

foreach (Document doc in myDocumentCollection.Documents)


//Add a stream to the imputStreamList for each document in the collection

FileStream inputFileStream = new FileStream(doc.FilePath, FileMode.Open);



//Merge the multi-stream of Pdfs into a new Pdf stream.

Stream[] inStreams = inputStreamList.ToArray();

PdfFileEditor pdfEditor = new PdfFileEditor();

FileStream outStream = new FileStream("c:\concatenatedResult.pdf", FileMode.Create);

pdfEditor.Concatenate(inStreams, outStream);


Is there any way I can use the Pdf.CompressionLevel Property to ensure the resultant concatenated PDF is at maximum compression (9) ?

Many Thanks


I am sorry but compression of existing pdf documents is not supported.


Is it possible to copy the contents of the concatenated document to a new one which has it’s compressionLevel = 9 ?


I am sorry but compression is only supported by Aspose.Pdf when creating new pdf files. Aspose.Pdf.Kit has no support for compression.