pdf_paradise 0.1.43

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pdf_paradise might be problematic. Click here for more details.

Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +376 -0
  3. data/bin/automatic_pdf_title +7 -0
  4. data/bin/convert_markdown_to_pdf +7 -0
  5. data/bin/convert_pdf_to_text +7 -0
  6. data/bin/merge_then_open +7 -0
  7. data/bin/n_pages +10 -0
  8. data/bin/open_main_pdf +7 -0
  9. data/bin/pdf_paradise +7 -0
  10. data/bin/set_main_book +7 -0
  11. data/bin/set_title_of_this_pdf_file +15 -0
  12. data/doc/README.gen +348 -0
  13. data/doc/todo/todo.md +2 -0
  14. data/lib/pdf_paradise.rb +5 -0
  15. data/lib/pdf_paradise/base/base.rb +173 -0
  16. data/lib/pdf_paradise/commandline/help.rb +69 -0
  17. data/lib/pdf_paradise/commandline/menu.rb +160 -0
  18. data/lib/pdf_paradise/compress_this_pdf_file.rb +82 -0
  19. data/lib/pdf_paradise/constants/constants.rb +59 -0
  20. data/lib/pdf_paradise/convert_text_to_pdf.rb +94 -0
  21. data/lib/pdf_paradise/css/project.css +17 -0
  22. data/lib/pdf_paradise/djvu_to_pdf.rb +85 -0
  23. data/lib/pdf_paradise/gui/README.md +6 -0
  24. data/lib/pdf_paradise/gui/fox/split_pdf_file.rb +77 -0
  25. data/lib/pdf_paradise/gui/gtk2/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +39 -0
  26. data/lib/pdf_paradise/gui/gtk2/pdf_viewer/pdf_viewer.rb +34 -0
  27. data/lib/pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb +34 -0
  28. data/lib/pdf_paradise/gui/gtk2/statistics_widget/statistics_widget.rb +34 -0
  29. data/lib/pdf_paradise/gui/gtk2/to_pdf/to_pdf.rb +32 -0
  30. data/lib/pdf_paradise/gui/gtk3/controller/controller.rb +197 -0
  31. data/lib/pdf_paradise/gui/gtk3/convert_pdf_to_text/convert_pdf_to_text.rb +34 -0
  32. data/lib/pdf_paradise/gui/gtk3/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +39 -0
  33. data/lib/pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb +34 -0
  34. data/lib/pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb +34 -0
  35. data/lib/pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb +34 -0
  36. data/lib/pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb +32 -0
  37. data/lib/pdf_paradise/gui/shared_code/convert_pdf_to_text/convert_pdf_to_text_module.rb +277 -0
  38. data/lib/pdf_paradise/gui/shared_code/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file_module.rb +428 -0
  39. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer.css +5 -0
  40. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb +284 -0
  41. data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file.css +0 -0
  42. data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb +294 -0
  43. data/lib/pdf_paradise/gui/shared_code/statistics_widget/statistics_widget_module.rb +333 -0
  44. data/lib/pdf_paradise/gui/shared_code/to_pdf/to_pdf_module.rb +273 -0
  45. data/lib/pdf_paradise/main_pdf/main_pdf.rb +437 -0
  46. data/lib/pdf_paradise/merge_pdf/menu.rb +63 -0
  47. data/lib/pdf_paradise/merge_pdf/merge_pdf.rb +292 -0
  48. data/lib/pdf_paradise/merge_pdf_namespace.rb +9 -0
  49. data/lib/pdf_paradise/merge_then_open/merge_then_open.rb +105 -0
  50. data/lib/pdf_paradise/pdf_file_n_total_pages.rb +227 -0
  51. data/lib/pdf_paradise/project/project_base_directory.rb +22 -0
  52. data/lib/pdf_paradise/remove_pdf_password.rb +392 -0
  53. data/lib/pdf_paradise/requires/batch_require_toplevel_files.rb +22 -0
  54. data/lib/pdf_paradise/requires/colours.rb +7 -0
  55. data/lib/pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb +11 -0
  56. data/lib/pdf_paradise/requires/esystem_and_colours.rb +10 -0
  57. data/lib/pdf_paradise/requires/esystem_and_opn_and_colours.rb +8 -0
  58. data/lib/pdf_paradise/requires/require_the_whole_project.rb +25 -0
  59. data/lib/pdf_paradise/requires/require_utility_scripts.rb +7 -0
  60. data/lib/pdf_paradise/rotate_pdf_file.rb +144 -0
  61. data/lib/pdf_paradise/set_main_book.rb +156 -0
  62. data/lib/pdf_paradise/set_pdf_title.rb +218 -0
  63. data/lib/pdf_paradise/sinatra/embeddable_interface.rb +315 -0
  64. data/lib/pdf_paradise/toplevel_methods/automatic_pdf_title.rb +55 -0
  65. data/lib/pdf_paradise/toplevel_methods/convert_epub_to_pdf.rb +27 -0
  66. data/lib/pdf_paradise/toplevel_methods/convert_markdown_to_pdf.rb +43 -0
  67. data/lib/pdf_paradise/toplevel_methods/convert_ppt_to_pdf.rb +35 -0
  68. data/lib/pdf_paradise/toplevel_methods/e.rb +16 -0
  69. data/lib/pdf_paradise/toplevel_methods/esystem.rb +19 -0
  70. data/lib/pdf_paradise/toplevel_methods/misc.rb +52 -0
  71. data/lib/pdf_paradise/toplevel_methods/number_pages.rb +38 -0
  72. data/lib/pdf_paradise/toplevel_methods/opened_pdf_files.rb +191 -0
  73. data/lib/pdf_paradise/toplevel_methods/query_pdf_title.rb +182 -0
  74. data/lib/pdf_paradise/toplevel_methods/reduce_size_of_this_pdf_file.rb +43 -0
  75. data/lib/pdf_paradise/toplevel_methods/roebe.rb +17 -0
  76. data/lib/pdf_paradise/toplevel_methods/to_pdf.rb +38 -0
  77. data/lib/pdf_paradise/utility_scripts/README.md +3 -0
  78. data/lib/pdf_paradise/utility_scripts/convert_pdf_to_text.rb +166 -0
  79. data/lib/pdf_paradise/utility_scripts/delete_first_page_of_this_pdf_file.rb +185 -0
  80. data/lib/pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb +180 -0
  81. data/lib/pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb +310 -0
  82. data/lib/pdf_paradise/utility_scripts/extract_pdf_page.rb +280 -0
  83. data/lib/pdf_paradise/utility_scripts/pdf_optimizer.rb +113 -0
  84. data/lib/pdf_paradise/utility_scripts/pdf_statistics.rb +150 -0
  85. data/lib/pdf_paradise/utility_scripts/remove_images.rb +110 -0
  86. data/lib/pdf_paradise/utility_scripts/split_pdf.rb +294 -0
  87. data/lib/pdf_paradise/utility_scripts/to_qdf.rb +82 -0
  88. data/lib/pdf_paradise/version/version.rb +19 -0
  89. data/lib/pdf_paradise/www/README.md +2 -0
  90. data/lib/pdf_paradise/www/sinatra/app.rb +276 -0
  91. data/pdf_paradise.gemspec +64 -0
  92. data/test/testing_pdf_paradise.rb +9 -0
  93. metadata +216 -0
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::DeleteLastPageOfThisPdfFile
6
+ #
7
+ # This class will accept one (or several) .pdf files and then proceed
8
+ # to remove the very last .pdf page in that file. So if that pdf-file
9
+ # has had 100 pages, we will end up with 99 pages.
10
+ #
11
+ # By default, the class here will create a new output file and leave
12
+ # the original file untouched.
13
+ #
14
+ # Note that this functionality depends on either "qpdf" or "pdftk".
15
+ # =========================================================================== #
16
+ # require 'pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb'
17
+ # =========================================================================== #
18
+ require 'pdf_paradise/base/base.rb'
19
+ require 'pdf_paradise/pdf_file_n_total_pages.rb'
20
+
21
+ module PdfParadise
22
+
23
+ class DeleteLastPageOfThisPdfFile < Base
24
+
25
+ # ========================================================================= #
26
+ # === NAMESPACE
27
+ # ========================================================================= #
28
+ NAMESPACE = inspect
29
+
30
+ # ========================================================================= #
31
+ # === OVERWRITE_THE_OLD_PDF_FILE
32
+ #
33
+ # If the following constant is set to true then the given input
34
+ # file will be overwritten.
35
+ # ========================================================================= #
36
+ OVERWRITE_THE_OLD_PDF_FILE = true
37
+
38
+ # ========================================================================= #
39
+ # === initialize
40
+ # ========================================================================= #
41
+ def initialize(
42
+ input_files = ARGV,
43
+ run_already = true
44
+ )
45
+ reset
46
+ set_input_files(input_files)
47
+ run if run_already
48
+ end
49
+
50
+ # ========================================================================= #
51
+ # === reset
52
+ # ========================================================================= #
53
+ def reset
54
+ super()
55
+ # ======================================================================= #
56
+ # === @namespace
57
+ # ======================================================================= #
58
+ @namespace = NAMESPACE
59
+ # ======================================================================= #
60
+ # === @overwrite_the_old_pdf_file
61
+ # ======================================================================= #
62
+ @overwrite_the_old_pdf_file = OVERWRITE_THE_OLD_PDF_FILE
63
+ end
64
+
65
+ # ========================================================================= #
66
+ # === set_input_files
67
+ # ========================================================================= #
68
+ def set_input_files(i)
69
+ i = [i] unless i.is_a? Array
70
+ if i.empty? and is_on_roebe?
71
+ # ===================================================================== #
72
+ # In this case we will use the main-pdf file, if it exists.
73
+ # ===================================================================== #
74
+ if ENV.has_key?('MAIN_BOOK') and
75
+ File.exist?(ENV['MAIN_BOOK'])
76
+ i << ENV['MAIN_BOOK'].dup
77
+ end
78
+ end
79
+ @input_files = i
80
+ sanitize_input_files
81
+ end
82
+
83
+ # ========================================================================= #
84
+ # === sanitize_input_files
85
+ # ========================================================================= #
86
+ def sanitize_input_files
87
+ unless @input_files.empty?
88
+ # ===================================================================== #
89
+ # Select only .pdf files next.
90
+ # ===================================================================== #
91
+ @input_files.select! {|entry|
92
+ entry.end_with? '.pdf'
93
+ }
94
+ end
95
+ end
96
+
97
+ # ========================================================================= #
98
+ # === process_each_pdf
99
+ # ========================================================================= #
100
+ def process_each_pdf
101
+ @input_files.each {|this_pdf_file|
102
+ # ===================================================================== #
103
+ # First, we must find out how many pdf pages are in the given
104
+ # pdf file at hand.
105
+ # ===================================================================== #
106
+ if File.exist? this_pdf_file
107
+ opnn; e 'Now working on the .pdf file '+sfancy(this_pdf_file)
108
+ has_n_pages = PdfParadise.n_pages_in_this_pdf_file?(this_pdf_file) # This is also the last page.
109
+ if use_pdftk?
110
+ _ = 'pdftk '+this_pdf_file+' cat 1-'+(has_n_pages.to_i - 1).to_s+' '+
111
+ has_n_pages.to_s+'-end output '+
112
+ name_of_the_output_file?(this_pdf_file)
113
+ else # else we use qpdf
114
+ _ = 'qpdf'.dup
115
+ if @overwrite_the_old_pdf_file
116
+ _ << ' --replace-input'
117
+ end
118
+ if @overwrite_the_old_pdf_file
119
+ _ << ' --pages '+this_pdf_file+' 1-'+(has_n_pages.to_i - 1).to_s+' -- '+
120
+ this_pdf_file
121
+ else
122
+ _ << ' --pages '+this_pdf_file+' 1-'+(has_n_pages.to_i - 1).to_s+' -- '+
123
+ this_pdf_file+' '+name_of_the_output_file?(this_pdf_file)
124
+ end
125
+ end
126
+ esystem _
127
+ else
128
+ opnn; e 'No file exists at `'+sfile(this_pdf_file)+'`.'
129
+ end
130
+ }
131
+ end
132
+
133
+ # ========================================================================= #
134
+ # === name_of_the_output_file?
135
+ # ========================================================================= #
136
+ def name_of_the_output_file?(i)
137
+ if @overwrite_the_old_pdf_file
138
+ i.sub(/\.pdf$/,'')+'.pdf'
139
+ else
140
+ i.sub(/\.pdf$/,'')+'_output_file.pdf'
141
+ end
142
+ end; alias output? name_of_the_output_file? # === output?
143
+
144
+ # ========================================================================= #
145
+ # === use_pdftk?
146
+ # ========================================================================= #
147
+ def use_pdftk?
148
+ false
149
+ end
150
+
151
+ # ========================================================================= #
152
+ # === input?
153
+ # ========================================================================= #
154
+ def input?
155
+ @input_files
156
+ end
157
+
158
+ # ========================================================================= #
159
+ # === run
160
+ # ========================================================================= #
161
+ def run
162
+ process_each_pdf
163
+ end
164
+
165
+ end
166
+
167
+ # =========================================================================== #
168
+ # === PdfParadise.delete_last_page_of_this_pdf_file
169
+ #
170
+ # Easier method-way to invoke the above class.
171
+ # =========================================================================== #
172
+ def self.delete_last_page_of_this_pdf_file(i = ARGV)
173
+ PdfParadise::DeleteLastPageOfThisPdfFile.new(i)
174
+ end; self.instance_eval { alias remove_the_last_page_of_this_pdf_file delete_last_page_of_this_pdf_file } # === PdfParadise.remove_the_last_page_of_this_pdf_file
175
+
176
+ end
177
+
178
+ if __FILE__ == $PROGRAM_NAME
179
+ PdfParadise::DeleteLastPageOfThisPdfFile.new(ARGV)
180
+ end # delete_last_page_of_this_pdf_file
@@ -0,0 +1,310 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::DeleteThisPageOfThisPdfFile
6
+ #
7
+ # This class will accept one (or several) .pdf files and then proceed
8
+ # to remove the specified .pdf page in that file.
9
+ #
10
+ # By default, the class here will honour the constant called
11
+ # OVERWRITE_THE_OLD_PDF_FILE in order to determine whether a new
12
+ # .pdf file is to be created, or whether to modify the original
13
+ # .pdf file as-is.
14
+ #
15
+ # Note that this functionality "contained" in this .rb file depends
16
+ # on either "qpdf" or "pdftk" - personally I much prefer qpdf these
17
+ # days.
18
+ # =========================================================================== #
19
+ # require 'pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb'
20
+ # =========================================================================== #
21
+ require 'pdf_paradise/base/base.rb'
22
+
23
+ module PdfParadise
24
+
25
+ class DeleteThisPageOfThisPdfFile < Base
26
+
27
+ require 'pdf_paradise/pdf_file_n_total_pages.rb'
28
+
29
+ # ========================================================================= #
30
+ # === NAMESPACE
31
+ # ========================================================================= #
32
+ NAMESPACE = inspect
33
+
34
+ # ========================================================================= #
35
+ # === OVERWRITE_THE_OLD_PDF_FILE
36
+ #
37
+ # If the following constant is set to true then the given input
38
+ # file will be overwritten. I prefer this on my home system, so
39
+ # the default is true for now.
40
+ # ========================================================================= #
41
+ OVERWRITE_THE_OLD_PDF_FILE = true
42
+
43
+ # ========================================================================= #
44
+ # === DEFAULT_REMOVE_THIS_PDF_PAGE
45
+ #
46
+ # If you don't feel like manually passing data to the .rb file, use
47
+ # the hardcoded value here.
48
+ # ========================================================================= #
49
+ DEFAULT_REMOVE_THIS_PDF_PAGE = 126
50
+
51
+ # ========================================================================= #
52
+ # === initialize
53
+ # ========================================================================= #
54
+ def initialize(
55
+ input_files = ARGV,
56
+ run_already = true
57
+ )
58
+ reset
59
+ set_commandline_arguments(
60
+ input_files
61
+ )
62
+ set_input_files(
63
+ input_files
64
+ )
65
+ # ======================================================================= #
66
+ # === Handle Blocks next
67
+ # ======================================================================= #
68
+ if block_given?
69
+ yielded = yield
70
+ case yielded
71
+ when :do_not_run_yet
72
+ run_already = false
73
+ end
74
+ end
75
+ run if run_already
76
+ end
77
+
78
+ # ========================================================================= #
79
+ # === reset
80
+ # ========================================================================= #
81
+ def reset
82
+ super()
83
+ # ======================================================================= #
84
+ # === @namespace
85
+ # ======================================================================= #
86
+ @namespace = NAMESPACE
87
+ # ======================================================================= #
88
+ # === @overwrite_the_old_pdf_file
89
+ #
90
+ # This determines whether the old .pdf file will be overwritten.
91
+ # ======================================================================= #
92
+ @overwrite_the_old_pdf_file = OVERWRITE_THE_OLD_PDF_FILE
93
+ # ======================================================================= #
94
+ # === @remove_this_pdf_page
95
+ #
96
+ # This variable keeps track as to which particular page we wish
97
+ # to remove from our .pdf file. By default we will set to one
98
+ # as is anyway.
99
+ # ======================================================================= #
100
+ @remove_this_pdf_page = DEFAULT_REMOVE_THIS_PDF_PAGE
101
+ end
102
+
103
+ # ========================================================================= #
104
+ # === show_help
105
+ # ========================================================================= #
106
+ def show_help
107
+ e
108
+ e 'The first argument should be the .pdf file.'
109
+ e 'The second argument should be the page number.'
110
+ e
111
+ end
112
+
113
+ # ========================================================================= #
114
+ # === set_input_files
115
+ # ========================================================================= #
116
+ def set_input_files(i)
117
+ i = [i] unless i.is_a? Array
118
+ @input_files = i
119
+ sanitize_input_files
120
+ end; alias set_pdf_file set_input_files # === set_pdf_file
121
+ alias set_pdf_files set_input_files # === set_pdf_files
122
+
123
+ # ========================================================================= #
124
+ # === sanitize_input_files
125
+ # ========================================================================= #
126
+ def sanitize_input_files
127
+ unless @input_files.empty?
128
+ set_page_number(
129
+ @input_files.select {|entry|
130
+ # ================================================================= #
131
+ # Get numbers.
132
+ # ================================================================= #
133
+ entry =~ /^\d+$/
134
+ }
135
+ )
136
+ # ===================================================================== #
137
+ # Select only .pdf files next.
138
+ # ===================================================================== #
139
+ @input_files.select! {|entry|
140
+ entry.end_with? '.pdf'
141
+ }
142
+ end
143
+ end
144
+
145
+ # ========================================================================= #
146
+ # === return_the_proper_range
147
+ #
148
+ # This method will return the proper range, such as:
149
+ #
150
+ # 1-9,11-z
151
+ #
152
+ # ========================================================================= #
153
+ def return_the_proper_range
154
+ before_part = "1-#{(@remove_this_pdf_page - 1).to_s}"
155
+ after_part = (@remove_this_pdf_page + 1).to_s+'-z'
156
+ "#{before_part},#{after_part}"
157
+ end
158
+
159
+ # ========================================================================= #
160
+ # === name_of_the_output_file?
161
+ # ========================================================================= #
162
+ def name_of_the_output_file?(i)
163
+ if @overwrite_the_old_pdf_file
164
+ i.sub(/\.pdf$/,'')+'.pdf'
165
+ else
166
+ i.sub(/\.pdf$/,'')+'_output_file.pdf'
167
+ end
168
+ end; alias output? name_of_the_output_file? # === output?
169
+
170
+ # ========================================================================= #
171
+ # === input?
172
+ # ========================================================================= #
173
+ def input?
174
+ @input_files
175
+ end
176
+
177
+ # ========================================================================= #
178
+ # === process_each_pdf
179
+ # ========================================================================= #
180
+ def process_each_pdf
181
+ @input_files.each {|this_pdf_file|
182
+ # ===================================================================== #
183
+ # The command should be something like this:
184
+ #
185
+ # qpdf input.pdf --pages input.pdf 1-9,26-z -- outputfile.pdf
186
+ #
187
+ # See: https://superuser.com/a/1297395
188
+ # ===================================================================== #
189
+ if File.exist? this_pdf_file
190
+ opnn; e 'Now working on the .pdf file '+sfancy(this_pdf_file)
191
+ opnn; e 'The page that will be removed is: '+
192
+ steelblue(@remove_this_pdf_page.to_s)
193
+ _ = 'qpdf'.dup
194
+ _ << " #{this_pdf_file}"
195
+ _ << " --pages #{this_pdf_file} "+return_the_proper_range
196
+ _ << " -- output.pdf"
197
+ esystem _
198
+ if @overwrite_the_old_pdf_file
199
+ output_file = 'output.pdf'
200
+ if File.exist? output_file
201
+ File.delete(this_pdf_file) if File.exist? this_pdf_file
202
+ move_file(output_file, this_pdf_file)
203
+ end
204
+ end
205
+ else
206
+ opnn; e "No file exists at `#{sfile(this_pdf_file)}`."
207
+ end
208
+ }
209
+ end
210
+
211
+ # ========================================================================= #
212
+ # === remove_this_pdf_page?
213
+ # ========================================================================= #
214
+ def remove_this_pdf_page?
215
+ @remove_this_pdf_page
216
+ end; alias page_number? remove_this_pdf_page? # === page_number?
217
+
218
+ # ========================================================================= #
219
+ # === set_remove_this_pdf_page
220
+ # ========================================================================= #
221
+ def set_remove_this_pdf_page(
222
+ i = nil
223
+ )
224
+ if i
225
+ if i.is_a? Array
226
+ i = i.first
227
+ end
228
+ if i.nil?
229
+ # In this case use the default value.
230
+ i = DEFAULT_REMOVE_THIS_PDF_PAGE
231
+ end
232
+ @remove_this_pdf_page = i.to_i
233
+ end
234
+ end; alias set_page_number set_remove_this_pdf_page # === set_page_number
235
+
236
+ # ========================================================================= #
237
+ # === menu (menu tag)
238
+ # ========================================================================= #
239
+ def menu(
240
+ i = return_commandline_arguments_starting_with_hyphens
241
+ )
242
+ if i.is_a? Array
243
+ i.each {|entry| menu(entry) }
244
+ else
245
+ case i
246
+ # ===================================================================== #
247
+ # === deletethispageofthispdffile DONE*pdf --remove-this-page-number=430
248
+ #
249
+ # Remove specific pages from a given .pdf file.
250
+ #
251
+ # Usage example:
252
+ #
253
+ # pagegone DONE*pdf --remove-this-page-number=360
254
+ # pagegone DONE*pdf --remove=94
255
+ # pagegone DONE*pdf --remove=162
256
+ # pagegone DONE*pdf --remove=307
257
+ #
258
+ # ===================================================================== #
259
+ when /^-?-?remove(-|_)?this(-|_)?page(-|_)?number=(.+)$/i, # === $4
260
+ /^-?-?remove=(.+)$/i # === $1
261
+ _ = $1.to_s.dup
262
+ _ = $4.to_s.dup if $4
263
+ set_remove_this_pdf_page(_)
264
+ # ===================================================================== #
265
+ # === --help
266
+ # ===================================================================== #
267
+ when /help/
268
+ show_help
269
+ exit
270
+ end
271
+ end
272
+ end
273
+
274
+ # ========================================================================= #
275
+ # === run
276
+ # ========================================================================= #
277
+ def run
278
+ menu
279
+ process_each_pdf
280
+ end
281
+
282
+ end
283
+
284
+ # =========================================================================== #
285
+ # === PdfParadise.remove_this_page_of_that_pdf_file
286
+ # =========================================================================== #
287
+ def self.remove_this_page_of_that_pdf_file(
288
+ this_page,
289
+ that_pdf_file
290
+ )
291
+ _ = PdfParadise::DeleteThisPageOfThisPdfFile.new { :do_not_run_yet }
292
+ _.set_pdf_file(that_pdf_file)
293
+ _.set_remove_this_pdf_page(this_page)
294
+ _.run
295
+ end
296
+
297
+ # =========================================================================== #
298
+ # === PdfParadise.delete_last_page_of_this_pdf_file
299
+ #
300
+ # Easier method-way to invoke the above class.
301
+ # =========================================================================== #
302
+ def self.delete_last_page_of_this_pdf_file(i = ARGV)
303
+ PdfParadise::DeleteThisPageOfThisPdfFile.new(i)
304
+ end
305
+
306
+ end
307
+
308
+ if __FILE__ == $PROGRAM_NAME
309
+ PdfParadise::DeleteThisPageOfThisPdfFile.new(ARGV)
310
+ end # deletethispageofthispdffile