Class: PDF::Reader::ObjectHash
- Inherits:
-
Object
- Object
- PDF::Reader::ObjectHash
- Defined in:
- lib/pdf/reader/patch/object_hash.rb
Overview
This monkey-patches pdf-reader to allow it to read PDFs that have junk characters that appear in the file before the start of the PDF stream. (this is quite commonly an html head block - I suspect a bug in the Adobe or other software used to serve the bills)
The patch has been contributed back to the pdf-reader project (github.com/yob/pdf-reader/pull/54) and has already been merged on master. When it shows up in a release of the pdf-reader gem we can trash this patch.
Instance Method Summary collapse
Instance Method Details
#extract_io_from(input) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/pdf/reader/patch/object_hash.rb', line 12 def extract_io_from(input) if input.respond_to?(:seek) && input.respond_to?(:read) input elsif File.file?(input.to_s) read_with_quirks(input) else raise ArgumentError, "input must be an IO-like object or a filename" end end |