I've searched many forums and blogs before posting the question.
I've found samples in python
and VB
which are using ZLib
.
but I can't get it to work in Delphi
.
I have the stream from a pdf
that is encoded with FlateDecode
.
Here is the stream saved as a simple file named "compressed_stream.pdf"
(in fact it's not pdf - it's only the stream, but I just left the .pdf
file extension)
https://files.fm/u/epka2hxz
Here is my code:
Execution goes to System.Zlib.ZDecompressStream(streamIn, streamOut);
and just sleeps... no errors, no crashes, nothing - just sleeps until I break the execution.
Any idea?
var
fs: TFileStream;
streamIn, streamOut: TMemoryStream;
begin
fs := TFileStream.Create(sDocumentFolder + 'compressed_stream.pdf', fmOpenRead);
streamIn := TMemoryStream.Create();
streamOut := TMemoryStream.Create();
streamIn.CopyFrom(fs, 0);
streamIn.Position := 0;
System.Zlib.ZDecompressStream(streamIn, streamOut);
end;