I want compress a PDF file of size 30.9MB to few 100KB, by using codes in C#.NET
FileStream sourceFileStream = File.OpenRead(@"D:\CMS\newsample.pdf");
FileStream destFileStream = File.Create(@"D:\ newsample_new.pdf");
GZipStream compressingStream = new GZipStream(destFileStream, CompressionMode.Compress);
byte[] bytes = new byte[2800];
int bytesRead;
while ((bytesRead = sourceFileStream.Read(bytes, 0, bytes.Length)) != 0)
{
compressingStream.Write(bytes, 0, bytesRead);
}
sourceFileStream.Close();
compressingStream.Close();
I use this code to compress the file but the compressed file size is 30.1MB only. Please tell me what is the change that I want to do in these code to get the above size or if there is any other option to done this compress process, please tell me