GZipStream problem
-
hi all, for compress the pdf file i use below code:
byte[] bufferWrite;
FileStream fsSource; FileStream fsDest; GZipStream gzCompressed; fsSource = new FileStream(@"C:\\Invoice.pdf", FileMode.Open, FileAccess.Read, FileShare.Read); bufferWrite = new byte\[fsSource.Length\]; fsSource.Read(bufferWrite, 0, bufferWrite.Length); fsDest = new FileStream(@"C:\\Invoice.zip", FileMode.OpenOrCreate, FileAccess.Write); gzCompressed = new GZipStream(fsDest, CompressionMode.Compress, true); gzCompressed.Write(bufferWrite, 0, bufferWrite.Length); fsSource.Close(); gzCompressed.Close(); fsDest.Close();
pdf file compress successfully but without extension(.pdf) .......where is problem?
-
hi all, for compress the pdf file i use below code:
byte[] bufferWrite;
FileStream fsSource; FileStream fsDest; GZipStream gzCompressed; fsSource = new FileStream(@"C:\\Invoice.pdf", FileMode.Open, FileAccess.Read, FileShare.Read); bufferWrite = new byte\[fsSource.Length\]; fsSource.Read(bufferWrite, 0, bufferWrite.Length); fsDest = new FileStream(@"C:\\Invoice.zip", FileMode.OpenOrCreate, FileAccess.Write); gzCompressed = new GZipStream(fsDest, CompressionMode.Compress, true); gzCompressed.Write(bufferWrite, 0, bufferWrite.Length); fsSource.Close(); gzCompressed.Close(); fsDest.Close();
pdf file compress successfully but without extension(.pdf) .......where is problem?
zeeShan anSari wrote:
pdf file compress successfully but without extension(.pdf) .......where is problem?
You named it .zip, just stop naming it .zip ? On the other hand, renaming a gzip file to .pdf doesn't (to my knowledge) suddenly make it a pdf file, it just makes your computer think it is.
-
zeeShan anSari wrote:
pdf file compress successfully but without extension(.pdf) .......where is problem?
You named it .zip, just stop naming it .zip ? On the other hand, renaming a gzip file to .pdf doesn't (to my knowledge) suddenly make it a pdf file, it just makes your computer think it is.
Thanks.........u r right :cool:
-
zeeShan anSari wrote:
pdf file compress successfully but without extension(.pdf) .......where is problem?
You named it .zip, just stop naming it .zip ? On the other hand, renaming a gzip file to .pdf doesn't (to my knowledge) suddenly make it a pdf file, it just makes your computer think it is.
-
-
No, are you? Some PDF readers may (in theory at least) decide to detect it and decompress the file before loading I wouldn't claim anything with full certainty without testing, and I'm not about to test every known PDF reader with gzipped pdf's
Today I have read CutePDF features, and it seems PDF supports commpresion. But it does not uses any zip, rar or any other container based compresion