class Mindee::Input::Source::Base64InputSource
Load a document from a base64 string.
def initialize(base64_string, filename, repair_pdf: false)
-
repair_pdf
(bool
) -- -
filename
(String
) -- -
base64_string
(String
) --
def initialize(base64_string, filename, repair_pdf: false) io_stream = StringIO.new(base64_string.unpack1('m*').to_s) io_stream.set_encoding Encoding::BINARY super(io_stream, filename, repair_pdf: repair_pdf) end
def read_contents(close: true)
-
(Array
-)
Parameters:
-
close
(bool
) --
def read_contents(close: true) @io_stream.seek(0) data = @io_stream.read @io_stream.close if close ['document', [data].pack('m'), { filename: Source.convert_to_unicode_escape(@filename) }] end