/usr/lib/ruby/vendor_ruby/pdf/reader/metadata_strategy.rb is in ruby-pdf-reader 1.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # coding: utf-8
class PDF::Reader
# DEPRECATED: this class was deprecated in version 0.11.0 and will
# eventually be removed
#
class MetadataStrategy < AbstractStrategy # :nodoc:
def self.to_sym
:metadata
end
def process
return false unless options[:metadata]
# may be useful to some people
callback(:pdf_version, ohash.pdf_version)
# ye olde metadata
callback(:metadata, [decoded_info]) if info?
# new style xml metadata
callback(:xml_metadata, [xml_metadata]) if xml_metadata?
# page count
if pages?
count = ohash.object(pages[:Count])
callback(:page_count, count.to_i)
end
end
private
def xml_metadata
return @xml_metadata if defined?(@xml_metadata)
if root[:Metadata].nil?
@xml_metadata = nil
else
string = ohash.object(root[:Metadata]).unfiltered_data
string.force_encoding("utf-8") if string.respond_to?(:force_encoding)
@xml_metadata = string
end
end
def xml_metadata?
xml_metadata ? true : false
end
def decoded_info
@decoded_info ||= decode_strings(info)
end
end
end
|