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();
destFileStream.Close();