lib/hexapdf/parser.rb in hexapdf-0.19.1 vs lib/hexapdf/parser.rb in hexapdf-0.19.2
- old
+ new
@@ -60,13 +60,19 @@
@tokenizer = Tokenizer.new(io, on_correctable_error: on_correctable_error)
@document = document
@object_stream_data = {}
@reconstructed_revision = nil
@in_reconstruct_revision = false
+ @contains_xref_streams = false
retrieve_pdf_header_offset_and_version
end
+ # Returns +true+ if the PDF file contains cross-reference streams.
+ def contains_xref_streams?
+ @contains_xref_streams
+ end
+
# Loads the indirect (potentially compressed) object specified by the given cross-reference
# entry.
#
# For information about the +xref_entry+ argument, have a look at HexaPDF::XRefSection and
# HexaPDF::XRefSection::Entry.
@@ -228,9 +234,10 @@
trailer = obj.trailer
unless xref_section.entry?(obj.oid, obj.gen)
maybe_raise("Cross-reference stream doesn't contain entry for itself", pos: pos)
xref_section.add_in_use_entry(obj.oid, obj.gen, pos)
end
+ @contains_xref_streams = true
end
xref_section.delete(0)
[xref_section, trailer]
end