Class: PdfParadise::ExtractAllImagesFromThisPdfFile
- Inherits:
-
Base
- Object
- Base
- PdfParadise::ExtractAllImagesFromThisPdfFile
show all
- Defined in:
- lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb
Overview
Constant Summary
collapse
- NAMESPACE =
inspect
Instance Method Summary
collapse
Methods inherited from Base
#basename, #be_verbose?, #change_directory, #commandline_arguments?, #copy_file, #delete_file, #e, #ecomment, #esystem, #first_argument?, #gold, #infer_the_namespace, #input_without_leading_hyphens?, #internal_hash?, #is_an_image_file?, #is_on_roebe?, #lightsteelblue, #log_dir?, #mkdir, #mv, #n_pages?, #namespace?, #no_file_at, #opne, #orange, #reset_the_internal_hash, #return_commandline_arguments_starting_with_hyphens, #return_files_from_the_commandline_arguments, #return_pwd, #rev, #set_be_quiet, #set_commandline_arguments, #steelblue, #try_to_ensure_that_this_directory_exists, #write_what_into
Constructor Details
#initialize(commandline_arguments = ARGV, run_already = true) ⇒ ExtractAllImagesFromThisPdfFile
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 26
def initialize(
commandline_arguments = ARGV,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
case run_already
when :do_not_run_yet
run_already = false
end
make_sure_that_the_first_argument_is_not_a_symbol
run if run_already
end
|
Instance Method Details
#determine_the_raw_name(_ = first_argument?
) ⇒ Object
#
determine_the_raw_name
This method will determine the raw filename.
#
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 77
def determine_the_raw_name(
_ = first_argument?
)
if _ and _.is_a?(Array)
_ = _.first
end
if _
_ = _.dup _.delete_suffix!('.pdf')
_ = File.basename(_) if _.include? '/'
end
@raw_name = _
end
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 97
def (
i = first_argument?
)
if @raw_name.nil?
determine_the_raw_name(i) if i
end
if i and File.exist?(i)
cmd = "pdfimages -j #{i} #{@raw_name}"
e
esystem cmd
e
else
e "No file exists at `#{i}`."
false
end
end
|
#make_sure_that_the_first_argument_is_not_a_symbol ⇒ Object
#
make_sure_that_the_first_argument_is_not_a_symbol
#
55
56
57
58
59
60
61
62
63
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 55
def make_sure_that_the_first_argument_is_not_a_symbol
if @commandline_arguments
if @commandline_arguments.is_a? Symbol
@commandline_arguments = []
elsif @commandline_arguments.first.is_a? Symbol
@commandline_arguments.shift
end
end
end
|
#opnn ⇒ Object
68
69
70
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 68
def opnn
super(NAMESPACE)
end
|
#reset ⇒ Object
48
49
50
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 48
def reset
super()
end
|
#run ⇒ Object
117
118
119
120
121
122
123
|
# File 'lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb', line 117
def run
_ = first_argument?
determine_the_raw_name(_)
if _ and File.exist?(_)
(_)
end
end
|