public Compressor(byte[] image) { buf1 = new MemoryStream(); if (PDF.original_zlib) { ods1 = new OptionalDeflateStream(buf1); ods1.Write(image, 0, image.Length); ods1.Close(); } else { dos1 = new DeflaterOutputStream(buf1, new Deflater()); dos1.Write(image, 0, image.Length); dos1.Finish(); } }
public DeflaterOutputStream(MemoryStream buf1, Deflater deflater) { this.buf1 = buf1; this.deflater = deflater; if (PDF.original_zlib) { ds2 = new OptionalDeflateStream(buf1); } else { buf2 = new MemoryStream(); buf2.WriteByte(0x58); // These are the correct values for buf2.WriteByte(0x85); // CMF and FLG according to Microsoft ds1 = new DeflateStream(buf2, CompressionMode.Compress, true); } }