Click here to Skip to main content
15,878,871 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i‘m developing a pdf parser,i have in real trouble,i can’t get it in myself.
PDF
6 0 obj
<</DecodeParms<</Columns 4/Predictor 12>>/Filter/FlateDecode/ID[<275EB65AA3259D4FB5B288864AD5DDFC><3476ED24B8B8844D840F1CF1600D5665>]/Info 23 0 R/Length 59/Root 25 0 R/Size 24/Type/XRef/W[1 2 1]>>stream
h辀b
endstream

i deflate in byte data between "stream" and "endstream" by zlib,but i cant continue parse the deflated data,i read the pdf reference 1.6,i find need to use pridictor funciton,how can tell me how to do it?
Posted

download the source code from http://zlib.net/[^] use the decompression function to decompress the data.

Even if you use in windows it wont be a problem, no change is required at all
 
Share this answer
 
Given the fact that this data chunk uses Predictor function 12, we can see on pg52 of pdfReference 1.6 that this corresponds to PNG prediction (on encoding, PNG Up on all rows)

In the middle of page 51 of the reference doc, we can see that the PNG predictor functions are defined within RFC 2083.

Here's the relevant section: RFC 2083, PNG - Section 6 Filter(ed: predictor) Functions[^]


It may be worth a look inside the code of pngLib or some other source-code distribution of a PNG writing/reading library, just to see how the algorithm has been successfully implemented.

I'd certainly be most interested in any/all progress. I'm Implementing a pdf creation class in c++, and have just abandoned lzwDecode owing to the lack of documentation on how to go about creating a PDF-legal lzw stream. Have found a couple of micro zlib implementations - typically only implementing the deflate method and any pre-requisites.
So, this is a little further up my alley than I am currently, though do hope to squish every last bit out of any encoded streams - it seems I'll need to use PNG predictors too at some point.

Cheers!
 
Share this answer
 
Comments
chp845 27-Mar-12 5:16am    
Thank you! according to the mupdf library,i have idea about pridictor algorithm.I'm trying decompressing the cross-reference stream.
I decompress the stream in zlib,then use predictor algorithm to chang the inflated data.
I wish to do it well.
but only say,it's too painful to see in english as a Chinese.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900