I have a PDF file I need to manipulate inside a Sencha web APP.

I need to load the file, search for specific patterns in the file (For example: numbers formatted like \d\d,\d\d\d etc.), highlight the different text paters in different colors, add some new text to it and some JavaScript functions.

I thought to take advantage of the incremental update features of the PDF format to add these highlights. but to do that I need to be able to read the content of the file and have correct references in the xref table of the PDF.

I read the file using an AJAX call then load the responseText in to a string so I can search, update and manipulate the text.

The problem is that some of the objects are compressed into streams using /Filter/FlateDecode, that makes the data in that stream unreadable and the references in the string I use to manipulate the PDF incorrect.
I need to inflate the encrypted streams to get a simple text file I can work with.

I tried to use zLib.js to inflate the encoded section with no success. I also tried to convert it to different encoding etc. but had no success.

Does anyone had a code sample or can direct me to a resource which shows who to inflate a decoded PDF stream using Javascript ?

Maybe a library which is already able to do what I need to do ?