Class: PdfParadise::CheckSyntaxOfPdfFiles
- Inherits:
-
Base
- Object
- Base
- PdfParadise::CheckSyntaxOfPdfFiles
show all
- Defined in:
- lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb
Overview
PdfParadise::CheckSyntaxOfPdfFiles
Constant Summary
Constants inherited
from Base
Base::NAMESPACE
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === PdfParadise::CheckSyntaxOfPdfFiles[] ========================================================================= #.
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, #opnn, #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(i = ARGV, run_already = true) ⇒ CheckSyntaxOfPdfFiles
26
27
28
29
30
31
32
33
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 26
def initialize(
i = ARGV,
run_already = true
)
reset
set_commandline_arguments(i)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
PdfParadise::CheckSyntaxOfPdfFiles[]
#
98
99
100
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 98
def self.[](i = ARGV)
new(i)
end
|
Instance Method Details
#check_this_pdf_file(i) ⇒ Object
#
check_this_pdf_file
This is the method that does the syntax-check, via qpdf.
The specific commandline that will be invoked is:
qpdf --check 09.11.2009_Scan_Dr_Kirchmayer_Statik_und_Edbebensicherheit.pdf
#
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 74
def check_this_pdf_file(
i
)
[i].flatten.compact.each {|this_pdf_file|
cmd_to_run = "qpdf --check #{this_pdf_file}"
e
e cmd_to_run
e
result = `#{cmd_to_run}`
if result.include? 'No syntax or stream encoding errors found'
e sfile(this_pdf_file)+rev+': all is fine with this .pdf file.'
else
e swarn('Some problem exists for ')+sfile(this_pdf_file)+rev
pp result
end
}
end
|
#reset ⇒ Object
38
39
40
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 38
def reset
super()
end
|
#run ⇒ Object
45
46
47
48
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 45
def run
_ = commandline_arguments?
work_on_these_files(_)
end
|
#work_on_these_files(i) ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb', line 53
def work_on_these_files(i)
if i.is_a?(Array) and (i.first == :work_on_every_pdf_file_in_the_current_working_directory)
i = Dir['*.pdf']
end
i.each {|entry|
if File.file?(entry)
check_this_pdf_file(entry)
end
}
end
|