 <p>The problem was that when the stream is read once the file offset position counter is moved to the end of file, using the same stream at others times you will get the error. I solved using <code>docStyle.reset();</code></p>