class Mindee::Input::Source::Base64InputSource
Load a document from a base64 string.
def initialize(base64_string, filename, fix_pdf: false)
-
fix_pdf
(Boolean
) -- -
filename
(String
) -- -
base64_string
(String
) --
def initialize(base64_string, filename, fix_pdf: false) io_stream = StringIO.new(base64_string.unpack1('m*')) io_stream.set_encoding Encoding::BINARY super(io_stream, filename, fix_pdf: fix_pdf) end
def read_document(close: true)
-
(Array
-)
Parameters:
-
close
(Boolean
) --
def read_document(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