compress(), zlib and FlateDecode filter in PDF stream

Dar Scott dsc at swcp.com
Sun Apr 17 18:00:00 EDT 2005


On Apr 17, 2005, at 2:53 PM, jbv wrote:

>> The Revolution compress() creates gzip which has a wrapper around the
>> zlib format.  You can dig into the binary and do primitive zlib
>> compression.  And decompression IF you know the length of the result.
>>
>
> Thanks for the reply.
> Could you please elaborate a bit on this,
> especially "digging into the binary" ?
> Do you mean I can remove the wrapper code ?

Remove the wrapper bytes.

Look at RFC1952, which describes gzip.  That is what compress() creates.

The gzip binary format consists of header, deflate blocks, crc and 
length.  The header generated by compress() is fixed length, so it is 
easy to remove.

To get the raw deflate blocks, just remove everything else or use a 
simple char n to m of compress(x).  The problem, of course, is figuring 
out the right n and m.

If those deflate blocks are what you want, then this should do it.  If 
not, then I misunderstood.

(For those curious, going the other direction is more interesting.)

Dar Scott

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     A Sponsor of RevCon West
**********************************************



More information about the use-livecode mailing list