lib/combine_pdf/parser.rb in combine_pdf-0.2.32 vs lib/combine_pdf/parser.rb in combine_pdf-0.2.33

- old
+ new

@@ -27,11 +27,11 @@ # a Float representing the PDF version of the data parsed (if exists). attr_reader :version # the info and root objects, as found (if found) in the PDF file. # # they are mainly to used to know if the file is (was) encrypted and to get more details. - attr_reader :info_object, :root_object, :names_object, :forms_object, :outlines_object + attr_reader :info_object, :root_object, :names_object, :forms_object, :outlines_object, :metadata attr_reader :allow_optional_content # when creating a parser, it is important to set the data (String) we wish to parse. # # <b>the data is required and it is not possible to set the data at a later stage</b> @@ -48,10 +48,11 @@ @root_object = {}.dup @info_object = {}.dup @names_object = {}.dup @outlines_object = {}.dup @forms_object = {}.dup + @metadata = nil @strings_dictionary = {}.dup # all strings are one string @version = nil @scanner = nil @allow_optional_content = options[:allow_optional_content] end @@ -104,11 +105,11 @@ PDFFilter.inflate_object o ## extract objects from stream to top level arry @parsed @scanner = StringScanner.new o[:raw_stream_content] stream_data = _parse_ id_array = [] - while stream_data[0].is_a? Fixnum + while stream_data[0].is_a? (Integer) id_array << stream_data.shift stream_data.shift end while id_array[0] && stream_data[0] stream_data[0] = { indirect_without_dictionary: stream_data[0] } unless stream_data[0].is_a?(Hash) @@ -219,10 +220,10 @@ out << out.pop.merge(indirect_generation_number: out.pop, indirect_reference_id: out.pop) else out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop } end fresh = true - # puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Fixnum) + # puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Integer) ########################################## ## parse a Hex String ########################################## elsif str = @scanner.scan(/<[0-9a-fA-F]*>/) # warn "Found a hex string"