Method: CombinePDF.load
- Defined in:
- lib/combine_pdf/api.rb
.load(file_name = '', options = {}) ⇒ Object
Create an empty PDF object or create a PDF object from a file (parsing the file).
- file_name
-
is the name of a file to be parsed.
8 9 10 11 12 |
# File 'lib/combine_pdf/api.rb', line 8 def load(file_name = '', = {}) raise TypeError, "couldn't parse data, expecting type String" unless file_name.is_a?(String) || file_name.is_a?(Pathname) return PDF.new if file_name == '' PDF.new(PDFParser.new(IO.read(file_name, mode: 'rb').force_encoding(Encoding::ASCII_8BIT), )) end |