lib/ocr-file/document.rb in ocr-file-0.0.6 vs lib/ocr-file/document.rb in ocr-file-0.0.7
- old
+ new
@@ -28,13 +28,14 @@
# PDF to Image Processing
optimise_pdf: true,
extract_pdf_images: true, # if false will screenshot each PDF page
temp_filename_prefix: 'image',
spelling_correction: true,
+ keep_files: false,
# Console Output
verbose: true,
- timing: true,
+ timing: true
}
attr_reader :original_file_path,
:filename,
:save_file_path,
@@ -116,10 +117,11 @@
text
end
def close
+ return if keep_files?
::OcrFile::FileHelpers.clear_folder(@temp_folder_path)
end
private
@@ -138,9 +140,13 @@
quality: @config[:quality],
dpi: @config[:dpi],
verbose: @config[:verbose]
)
end
+ end
+
+ def keep_files?
+ config['keep_files']
end
def create_temp_folder
date = Time.now.to_s.split(' ').first