Index: poppler/Parser.cc =================================================================== --- poppler/Parser.cc (revision 50) +++ poppler/Parser.cc (revision 51) @@ -170,6 +170,11 @@ baseStr = lexer->getStream()->getBaseStream(); // skip over stream data + if (Lexer::LOOK_VALUE_NOT_CACHED != lexer->lookCharLastValueCached) { + // take into account the fact that we've cached one value + pos = pos - 1; + lexer->lookCharLastValueCached = Lexer::LOOK_VALUE_NOT_CACHED; + } lexer->setPos(pos + length); // refill token buffers and check for 'endstream' Index: poppler/Lexer.h =================================================================== --- poppler/Lexer.h (revision 50) +++ poppler/Lexer.h (revision 51) @@ -63,11 +63,7 @@ // Returns true if is a whitespace character. static GBool isSpace(int c); -private: - int getChar(); - int lookChar(); - // often (e.g. ~30% on PDF Refernce 1.6 pdf file from Adobe site) getChar // is called right after lookChar. In order to avoid expensive re-doing // getChar() of underlying stream, we cache the last value found by @@ -77,6 +73,11 @@ static const int LOOK_VALUE_NOT_CACHED = -3; int lookCharLastValueCached; +private: + + int getChar(); + int lookChar(); + Array *streams; // array of input streams int strPtr; // index of current stream Object curStr; // current stream