Some days ago I was trying to find a utility or a library in PHP that would let me extract the images... Seeing as after hours of googling I didn't find anything free and trustworthy, I decided to take up the challenge myself. After reading part of the reference, I tried to start writing some code to parse the objects (I'll read the rest when I need it).
Well, it turns out that right now I'm trying to apply the stream filters, and I'm having a problem with FlateDecode. I thought that I could use the default PHP function for zlib/inflate, but when I tried it, it threw me a data error. I checked that my code wasn't cutting chars off the stream; and I even tried reversing the predictor before inflating (even though if it's applied before encoding, it should be reversed after decoding). Then I went back on Google, and I couldn't find anything about more than one deflate implementation or about FlateDecode not being the same as zlib/deflate. So right now I'm not sure what's wrong...
The stream I was trying to decode was a cross-reference stream, and the file actually opens on Adobe Reader, so it's not a wrong encoding. (Though I must say it's a linearized document, perhaps it has something to do?)
Could anyone shed a little light on this?
I found it in another thread and (after a little tweak-and-try) it worked. It was about removing the first two bytes of data and then adding the headers (31, 139, 8, 0, 0, 0, 0, 0, 0, 1); though with the gzinflate() function in PHP the headers weren't needed and I just had to remove the first two bytes.