<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>specs/data/content_stream_with_length_as_ref_and_windows_breaks.pdf</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -72,7 +72,7 @@ class PDF::Reader
     # If the object is a stream, that is returned as well
     def object (ref, save_pos = true)
       return ref unless ref.kind_of?(Reference)
-      pos = @buffer.pos if save_pos
+      pos = @buffer.pos - @buffer.raw.to_s.size if save_pos
       obj = Parser.new(@buffer.seek(offset_for(ref)), self).object(ref.id, ref.gen)
       @buffer.seek(pos) if save_pos
       return obj</diff>
      <filename>lib/pdf/reader/xref.rb</filename>
    </modified>
    <modified>
      <diff>@@ -135,4 +135,16 @@ context &quot;PDF::Reader&quot; do
     receiver.content.size.should eql(1)
     receiver.content[0].should eql(&quot;HelloWorld&quot;)
   end
+
+  # PDF::Reader::XRef#object was saving an incorrect position when seeking. We
+  # were saving the current pos of the underlying IO stream, then seeking back
+  # to it. This was fine, except when there was still content in the buffer.
+  specify &quot;should correctly process a PDF with a stream that has its length specified as an indirect reference and uses windows line breaks&quot; do
+    receiver = PageTextReceiver.new
+    PDF::Reader.file(File.dirname(__FILE__) + &quot;/data/content_stream_with_length_as_ref_and_windows_breaks.pdf&quot;, receiver)
+
+    # confirm the text appears on the correct pages
+    receiver.content.size.should eql(1)
+    receiver.content[0].should eql(&quot;HelloWorld&quot;)
+  end
 end</diff>
      <filename>specs/meta_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ebd59ab016a51b1d057251f9624ad9cbcfa9cf03</id>
    </parent>
  </parents>
  <author>
    <name>James Healy</name>
    <email>jimmy@deefa.com</email>
  </author>
  <url>http://github.com/yob/pdf-reader/commit/090638048a38896b2b501421837ebbb3be9d9b03</url>
  <id>090638048a38896b2b501421837ebbb3be9d9b03</id>
  <committed-date>2009-04-24T01:59:31-07:00</committed-date>
  <authored-date>2009-04-24T01:59:31-07:00</authored-date>
  <message>Fix a bug in PDF::Reader::XRef#object()
- PDF::Reader::XRef#object was saving an incorrect position when seeking. We
  were saving the current pos of the underlying IO stream, then seeking back
  to it. This was fine, except when there was still content in the buffer.</message>
  <tree>967b8014d995fe3b6c41d6206614e30a0c491639</tree>
  <committer>
    <name>James Healy</name>
    <email>jimmy@deefa.com</email>
  </committer>
</commit>
