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();
oliver allardycePosted Sep 11, 2014, 8:20 AM
However, if the source contains images (pictures) of text, it can be reduced significantly if you convert the images to actual text and save it without the original images.
To do the conversion from images to text, you will need to perform optical character recognition (OCR) using a good OCR engine such as Leadtools.