Class: PdfParadise::CompressThisPdfFile
- Inherits:
-
Base
- Object
- Base
- PdfParadise::CompressThisPdfFile
show all
- Includes:
- FileUtils::Verbose
- Defined in:
- lib/pdf_paradise/compress/compress_this_pdf_file.rb
Overview
PdfParadise::CompressThisPdfFile
Constant Summary
Constants inherited
from Base
Base::NAMESPACE
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) ⇒ CompressThisPdfFile
25
26
27
28
29
30
31
32
|
# File 'lib/pdf_paradise/compress/compress_this_pdf_file.rb', line 25
def initialize(
i = ARGV,
run_already = true
)
reset
set_commandline_arguments(i)
run if run_already
end
|
Instance Method Details
#do_work_on_all_files(i = @work_on_these_files) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/pdf_paradise/compress/compress_this_pdf_file.rb', line 65
def do_work_on_all_files(
i = @work_on_these_files
)
i.each {|this_file|
store_into_this_file = 'compressed_PDF_file.pdf'
cmd = "gs -sDEVICE=pdfwrite "\
"-dCompatibilityLevel=#{@use_this_compatibility_level} "\
"-dPDFSETTINGS=/#{@d_pdf_settings_value} "\
"-dNOPAUSE -dQUIET -dBATCH "\
"-sOutputFile=#{store_into_this_file} #{this_file}"
e
e "#{rev}The compressed .pdf file will be stored "\
"here: #{sfile(store_into_this_file)}"
e
esystem cmd
e
}
end
|
#reset ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/pdf_paradise/compress/compress_this_pdf_file.rb', line 37
def reset
super()
infer_the_namespace
@use_this_compatibility_level = '1.7'
@d_pdf_settings_value = :screen end
|
#run ⇒ Object
#
run (run tag)
Note that using /ebook rather than /prepress would reduce the file size even further.
#
90
91
92
93
|
# File 'lib/pdf_paradise/compress/compress_this_pdf_file.rb', line 90
def run
set_work_on_these_files(commandline_arguments?)
do_work_on_all_files
end
|
#set_work_on_these_files(i) ⇒ Object
#
set_work_on_these_files
#
58
59
60
|
# File 'lib/pdf_paradise/compress/compress_this_pdf_file.rb', line 58
def set_work_on_these_files(i)
@work_on_these_files = [i].flatten.compact
end
|