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);

inputStreamList.Add(inputFileStream);

}

//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);

outStream.Close();

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

Many Thanks

Hi,

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

Thanks.

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

Hi,

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

Thanks.