pdf_paradise 0.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +933 -0
  3. data/bin/automatic_pdf_title +7 -0
  4. data/bin/burst_this_pdf_file +7 -0
  5. data/bin/combine_these_pdf_pages +7 -0
  6. data/bin/compress_via_hexapdf +7 -0
  7. data/bin/convert_markdown_to_pdf +7 -0
  8. data/bin/convert_pdf_to_text +7 -0
  9. data/bin/delete_first_page_of_this_pdf_file +7 -0
  10. data/bin/djvu_to_pdf +7 -0
  11. data/bin/merge_then_open +7 -0
  12. data/bin/n_pages +10 -0
  13. data/bin/open_main_pdf +7 -0
  14. data/bin/pdf_paradise +9 -0
  15. data/bin/rotate_pdf +7 -0
  16. data/bin/set_main_book +7 -0
  17. data/bin/set_title_of_this_pdf_file +15 -0
  18. data/doc/README.gen +871 -0
  19. data/doc/todo/todo.md +13 -0
  20. data/images/Logo_for_the_pdf_paradise_project.avif +0 -0
  21. data/lib/pdf_paradise/base/base.rb +344 -0
  22. data/lib/pdf_paradise/base/colours.rb +67 -0
  23. data/lib/pdf_paradise/colours/colours.rb +27 -0
  24. data/lib/pdf_paradise/commandline/commandline.rb +109 -0
  25. data/lib/pdf_paradise/commandline/help.rb +77 -0
  26. data/lib/pdf_paradise/commandline/menu.rb +173 -0
  27. data/lib/pdf_paradise/compress/compress_this_pdf_file.rb +108 -0
  28. data/lib/pdf_paradise/compress/compress_via_hexapdf.rb +27 -0
  29. data/lib/pdf_paradise/compress/compress_via_qpdf.rb +32 -0
  30. data/lib/pdf_paradise/constants/constants.rb +76 -0
  31. data/lib/pdf_paradise/convert_text_to_pdf.rb +94 -0
  32. data/lib/pdf_paradise/css/project.css +17 -0
  33. data/lib/pdf_paradise/fpdf/README.md +2 -0
  34. data/lib/pdf_paradise/fpdf/bookmark.rb +129 -0
  35. data/lib/pdf_paradise/fpdf/chinese.rb +454 -0
  36. data/lib/pdf_paradise/fpdf/fpdf.rb +1902 -0
  37. data/lib/pdf_paradise/fpdf/fpdf_eps.rb +138 -0
  38. data/lib/pdf_paradise/fpdf/makefont.rb +1794 -0
  39. data/lib/pdf_paradise/gui/README.md +6 -0
  40. data/lib/pdf_paradise/gui/fox/split_pdf_file.rb +77 -0
  41. data/lib/pdf_paradise/gui/gtk2/pdf_viewer/pdf_viewer.rb +34 -0
  42. data/lib/pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb +34 -0
  43. data/lib/pdf_paradise/gui/gtk2/statistics_widget/statistics_widget.rb +34 -0
  44. data/lib/pdf_paradise/gui/gtk3/controller/controller.rb +214 -0
  45. data/lib/pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb +34 -0
  46. data/lib/pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb +34 -0
  47. data/lib/pdf_paradise/gui/jruby/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +167 -0
  48. data/lib/pdf_paradise/gui/jruby/remove_the_first_page_of_this_pdf_file/remove_the_first_page_of_this_pdf_file.rb +103 -0
  49. data/lib/pdf_paradise/gui/libui/extract_all_images_from_this_pdf_file/extract_all_images_from_this_pdf_file.rb +223 -0
  50. data/lib/pdf_paradise/gui/libui/remove_the_first_page_of_this_pdf_file/remove_the_first_page_of_this_pdf_file.rb +267 -0
  51. data/lib/pdf_paradise/gui/libui/rotate_pdf_file/rotate_pdf_file.rb +219 -0
  52. data/lib/pdf_paradise/gui/libui/statistics_widget/statistics_widget.rb +233 -0
  53. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer.css +5 -0
  54. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb +287 -0
  55. data/lib/pdf_paradise/gui/shared_code/remove_the_first_page_of_this_pdf_file_module/remove_the_first_page_of_this_pdf_file_module.rb +31 -0
  56. data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb +295 -0
  57. data/lib/pdf_paradise/gui/universal_widgets/convert_pdf_to_text/convert_pdf_to_text.rb +366 -0
  58. data/lib/pdf_paradise/gui/universal_widgets/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +776 -0
  59. data/lib/pdf_paradise/gui/universal_widgets/statistics_widget/statistics_widget.rb +407 -0
  60. data/lib/pdf_paradise/gui/universal_widgets/to_pdf/to_pdf.rb +351 -0
  61. data/lib/pdf_paradise/hexapdf/001_rainbow_pattern_example.rb +0 -0
  62. data/lib/pdf_paradise/hexapdf/hexapdf.rb +123 -0
  63. data/lib/pdf_paradise/images/PDF_PARADISE_LOGO.png +0 -0
  64. data/lib/pdf_paradise/main_pdf/main_pdf.rb +474 -0
  65. data/lib/pdf_paradise/merge_pdf/menu.rb +63 -0
  66. data/lib/pdf_paradise/merge_pdf/merge_pdf.rb +307 -0
  67. data/lib/pdf_paradise/merge_pdf_namespace.rb +9 -0
  68. data/lib/pdf_paradise/merge_then_open/merge_then_open.rb +105 -0
  69. data/lib/pdf_paradise/prawn_addons/README.md +2 -0
  70. data/lib/pdf_paradise/prawn_addons/prawn_addons.rb +17 -0
  71. data/lib/pdf_paradise/project/project.rb +22 -0
  72. data/lib/pdf_paradise/remove_pdf_password.rb +391 -0
  73. data/lib/pdf_paradise/requires/batch_require_toplevel_files.rb +22 -0
  74. data/lib/pdf_paradise/requires/colours.rb +11 -0
  75. data/lib/pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb +13 -0
  76. data/lib/pdf_paradise/requires/esystem_and_colours.rb +11 -0
  77. data/lib/pdf_paradise/requires/esystem_and_opn_and_colours.rb +10 -0
  78. data/lib/pdf_paradise/requires/require_the_whole_project.rb +30 -0
  79. data/lib/pdf_paradise/requires/require_utility_scripts.rb +9 -0
  80. data/lib/pdf_paradise/set_main_book.rb +156 -0
  81. data/lib/pdf_paradise/set_pdf_title.rb +220 -0
  82. data/lib/pdf_paradise/sinatra/embeddable_interface.rb +389 -0
  83. data/lib/pdf_paradise/toplevel_methods/convert_epub_to_pdf.rb +27 -0
  84. data/lib/pdf_paradise/toplevel_methods/convert_markdown_to_pdf.rb +45 -0
  85. data/lib/pdf_paradise/toplevel_methods/convert_ppt_to_pdf.rb +35 -0
  86. data/lib/pdf_paradise/toplevel_methods/e.rb +16 -0
  87. data/lib/pdf_paradise/toplevel_methods/esystem.rb +20 -0
  88. data/lib/pdf_paradise/toplevel_methods/misc.rb +228 -0
  89. data/lib/pdf_paradise/toplevel_methods/number_pages.rb +38 -0
  90. data/lib/pdf_paradise/toplevel_methods/opened_pdf_files.rb +221 -0
  91. data/lib/pdf_paradise/toplevel_methods/query_pdf_title.rb +201 -0
  92. data/lib/pdf_paradise/toplevel_methods/reduce_size_of_this_pdf_file.rb +46 -0
  93. data/lib/pdf_paradise/toplevel_methods/roebe.rb +17 -0
  94. data/lib/pdf_paradise/toplevel_methods/to_pdf.rb +12 -0
  95. data/lib/pdf_paradise/utility_scripts/README.md +3 -0
  96. data/lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb +104 -0
  97. data/lib/pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb +106 -0
  98. data/lib/pdf_paradise/utility_scripts/combine_these_pdf_pages.rb +118 -0
  99. data/lib/pdf_paradise/utility_scripts/convert_pdf_to_text.rb +179 -0
  100. data/lib/pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb +180 -0
  101. data/lib/pdf_paradise/utility_scripts/delete_the_first_page_of_this_pdf_file/delete_the_first_page_of_this_pdf_file.rb +429 -0
  102. data/lib/pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb +356 -0
  103. data/lib/pdf_paradise/utility_scripts/djvu_to_pdf.rb +87 -0
  104. data/lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb +129 -0
  105. data/lib/pdf_paradise/utility_scripts/extract_pdf_page.rb +283 -0
  106. data/lib/pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb +348 -0
  107. data/lib/pdf_paradise/utility_scripts/pdf_optimizer.rb +111 -0
  108. data/lib/pdf_paradise/utility_scripts/pdf_statistics.rb +148 -0
  109. data/lib/pdf_paradise/utility_scripts/pdf_to_html.rb +75 -0
  110. data/lib/pdf_paradise/utility_scripts/remove_images.rb +110 -0
  111. data/lib/pdf_paradise/utility_scripts/rotate_pdf_file.rb +303 -0
  112. data/lib/pdf_paradise/utility_scripts/split_pdf.rb +364 -0
  113. data/lib/pdf_paradise/utility_scripts/to_pdf.rb +130 -0
  114. data/lib/pdf_paradise/utility_scripts/to_qdf.rb +66 -0
  115. data/lib/pdf_paradise/version/version.rb +19 -0
  116. data/lib/pdf_paradise/www/README.md +2 -0
  117. data/lib/pdf_paradise/www/sinatra/app.rb +304 -0
  118. data/lib/pdf_paradise/yaml/working_on_these_pdf_files.yml +4 -0
  119. data/lib/pdf_paradise.rb +5 -0
  120. data/pdf_paradise.gemspec +61 -0
  121. data/test/fpdf/001_minimal_example.rb +12 -0
  122. data/test/fpdf/002.pdf +0 -0
  123. data/test/fpdf/002_header_and_footer_example.rb +64 -0
  124. data/test/fpdf/003.pdf +98 -0
  125. data/test/fpdf/003_justified_paragraphs.rb +96 -0
  126. data/test/fpdf/file1.md +3 -0
  127. data/test/fpdf/file2.md +3 -0
  128. data/test/fpdf/test.pdf +0 -0
  129. data/test/testing_pdf_paradise.rb +12 -0
  130. metadata +239 -0
data/doc/todo/todo.md ADDED
@@ -0,0 +1,13 @@
1
+ - Add a converter-GUI.
2
+
3
+ From .docx to .pdf via libreoffice.
4
+ ^^^^ support this via that GUI.
5
+ ^^^ yeah
6
+
7
+ ^^ this works but has to be polished still.
8
+
9
+
10
+ - add the above alias
11
+ then integrate it into some libui gui or something
12
+ then perhaps jruby or something hmmmmm
13
+ ^^^ we need to add more jruby
@@ -0,0 +1,344 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/base/base.rb'; < ::PdfParadise::Base
6
+ # =========================================================================== #
7
+ require 'pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb'
8
+
9
+ module PdfParadise
10
+
11
+ class Base # === PdfParadise::Base
12
+
13
+ require 'yaml'
14
+ require 'fileutils'
15
+ require 'pdf_paradise/base/colours.rb'
16
+ require 'pdf_paradise/toplevel_methods/roebe.rb'
17
+ require 'pdf_paradise/toplevel_methods/misc.rb'
18
+ require 'pdf_paradise/constants/constants.rb'
19
+
20
+ begin
21
+ require 'cliner'
22
+ rescue LoadError; end
23
+
24
+ # ========================================================================= #
25
+ # === NAMESPACE
26
+ # ========================================================================= #
27
+ NAMESPACE = inspect
28
+
29
+ # ========================================================================= #
30
+ # === initialize
31
+ # ========================================================================= #
32
+ def initialize
33
+ reset
34
+ end
35
+
36
+ # ========================================================================= #
37
+ # === reset (reset tag)
38
+ # ========================================================================= #
39
+ def reset
40
+ # ======================================================================= #
41
+ # === @be_verbose
42
+ # ======================================================================= #
43
+ @be_verbose = true
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === set_commandline_arguments
48
+ # ========================================================================= #
49
+ def set_commandline_arguments(i)
50
+ i = [i].flatten.compact
51
+ @commandline_arguments = i
52
+ end
53
+
54
+ # ========================================================================= #
55
+ # === set_be_quiet
56
+ # ========================================================================= #
57
+ def set_be_quiet
58
+ @be_verbose = false
59
+ end
60
+
61
+ # ========================================================================= #
62
+ # === be_verbose?
63
+ # ========================================================================= #
64
+ def be_verbose?
65
+ @be_verbose
66
+ end
67
+
68
+ # ========================================================================= #
69
+ # === no_file_at
70
+ #
71
+ # This method (or its alias) can be used to notify the user that the
72
+ # given file does not exist at that given location (denoted by the
73
+ # argument called i).
74
+ # ========================================================================= #
75
+ def no_file_at(i)
76
+ e "No file called `#{sfile(i)}` exists at that target."
77
+ end; alias no_file_exists_at no_file_at # === no_file_exists_at
78
+
79
+ # ========================================================================= #
80
+ # === is_on_roebe?
81
+ # ========================================================================= #
82
+ def is_on_roebe?
83
+ ::PdfParadise.is_on_roebe?
84
+ end
85
+
86
+ # ========================================================================= #
87
+ # === return_files_from_the_commandline_arguments
88
+ #
89
+ # This method will return all existing files from the commandline
90
+ # arguments.
91
+ # ========================================================================= #
92
+ def return_files_from_the_commandline_arguments
93
+ @commandline_arguments.select {|entry|
94
+ File.file?(entry.to_s)
95
+ }
96
+ end
97
+
98
+ # ========================================================================= #
99
+ # === return_pwd
100
+ # ========================================================================= #
101
+ def return_pwd
102
+ "#{Dir.pwd}/".squeeze('/')
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === commandline_arguments?
107
+ # ========================================================================= #
108
+ def commandline_arguments?
109
+ @commandline_arguments
110
+ end; alias input? commandline_arguments? # === input?
111
+
112
+ # ========================================================================= #
113
+ # === first_argument?
114
+ # ========================================================================= #
115
+ def first_argument?
116
+ @commandline_arguments.first
117
+ end
118
+
119
+ # ========================================================================= #
120
+ # === input_without_leading_hyphens?
121
+ #
122
+ # This method will return the input that will not begin with --.
123
+ # ========================================================================= #
124
+ def input_without_leading_hyphens?
125
+ @commandline_arguments.reject {|entry| entry.start_with? '--' }
126
+ end
127
+
128
+ # ========================================================================= #
129
+ # === return_commandline_arguments_starting_with_hyphens
130
+ # ========================================================================= #
131
+ def return_commandline_arguments_starting_with_hyphens(
132
+ i = @commandline_arguments
133
+ )
134
+ [i].flatten.select {|entry| entry.start_with? '--' }
135
+ end; alias return_hyphen_arguments return_commandline_arguments_starting_with_hyphens # === return_hyphen_arguments
136
+
137
+ # ========================================================================= #
138
+ # === copy_file
139
+ # ========================================================================= #
140
+ def copy_file(
141
+ from, to = (Dir.pwd+'/').squeeze('/')
142
+ )
143
+ if File.exist? from
144
+ FileUtils.cp(from, to)
145
+ end
146
+ end
147
+
148
+ # ========================================================================= #
149
+ # === change_directory (cd tag)
150
+ # ========================================================================= #
151
+ def change_directory(i)
152
+ Dir.chdir(i) if File.directory?(i)
153
+ end; alias cd change_directory # === cd
154
+
155
+ # ========================================================================= #
156
+ # === write_what_into
157
+ # ========================================================================= #
158
+ def write_what_into(
159
+ what, into
160
+ )
161
+ begin
162
+ require 'save_file/module' unless Object.const_defined?(:SaveFile)
163
+ rescue LoadError; end
164
+ if Object.const_defined?(:SaveFile)
165
+ SaveFile.write_what_into(what, into)
166
+ else
167
+ e 'Can not save into '+into+' as the save_file gem '\
168
+ 'is not available/installed.'
169
+ end
170
+ end; alias save_what_into write_what_into # === save_what_into
171
+
172
+ # ========================================================================= #
173
+ # === n_pages?
174
+ #
175
+ # This method will return how many pages are in the given .pdf file at
176
+ # hand.
177
+ # ========================================================================= #
178
+ def n_pages?(i)
179
+ unless PdfParadise.const_defined? :PdfFileNTotalPages
180
+ require 'pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb'
181
+ end
182
+ ::PdfParadise.n_pdf_pages?(i)
183
+ end
184
+
185
+ # ========================================================================= #
186
+ # === esystem
187
+ #
188
+ # This method can be used to execute system-commands.
189
+ # ========================================================================= #
190
+ def esystem(i)
191
+ e steelblue(i)
192
+ system(i)
193
+ end
194
+
195
+ # ========================================================================= #
196
+ # === namespace?
197
+ # ========================================================================= #
198
+ def namespace?
199
+ @namespace
200
+ end
201
+
202
+ # ========================================================================= #
203
+ # === is_an_image_file?
204
+ # ========================================================================= #
205
+ def is_an_image_file?(i)
206
+ i.end_with?(
207
+ '.jpg','.png','.gif'
208
+ )
209
+ end
210
+
211
+ # ========================================================================= #
212
+ # === opnn
213
+ # ========================================================================= #
214
+ def opnn(
215
+ i = namespace?,
216
+ &block
217
+ )
218
+ if i.is_a? String
219
+ i = { namespace: i }
220
+ end
221
+ Opn.opn(i, &block)
222
+ end
223
+
224
+ # ========================================================================= #
225
+ # === infer_the_namespace
226
+ #
227
+ # This will assume the true namespace from the inspectable name.
228
+ # ========================================================================= #
229
+ def infer_the_namespace
230
+ _ = inspect
231
+ if _.include?(':0x')
232
+ _ = _.split(':0x').first.to_s.strip
233
+ end
234
+ _ = _.to_s.delete('<')
235
+ if _.include? ' '
236
+ _ = _.split(' ').first.delete('#')
237
+ if _.include? ':'
238
+ _ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
239
+ end
240
+ end
241
+ @namespace = _.delete('#') # And assign it here.
242
+ end
243
+
244
+ # ========================================================================= #
245
+ # === opne
246
+ # ========================================================================= #
247
+ def opne(i = '')
248
+ opnn; e i
249
+ end
250
+
251
+ # ========================================================================= #
252
+ # === mv (mv tag, move tag, rename tag)
253
+ # ========================================================================= #
254
+ def mv(
255
+ old,
256
+ new
257
+ )
258
+ # ======================================================================= #
259
+ # We must check that both files exist, before we delete the new file,
260
+ # as we may otherwise end up without any .pdf file. This has happened
261
+ # to me in August 2019 when qpdf failed to do a conversion.
262
+ # ======================================================================= #
263
+ if File.file?(new) and File.file?(old)
264
+ begin
265
+ File.delete(new)
266
+ rescue Exception => error
267
+ pp error
268
+ e 'Error trying to delete the file '+new+'.'
269
+ end
270
+ end
271
+ if File.exist? old
272
+ FileUtils.mv(old, new)
273
+ else
274
+ e 'No file exists at '+sfile(old)+'.'
275
+ end
276
+ end; alias move_file mv # === move_file
277
+
278
+ # ========================================================================= #
279
+ # === basename
280
+ # ========================================================================= #
281
+ def basename(i)
282
+ File.basename(i)
283
+ end
284
+
285
+ # ========================================================================= #
286
+ # === delete_file
287
+ #
288
+ # This method can be used to delete a local file.
289
+ # ========================================================================= #
290
+ def delete_file(i)
291
+ begin
292
+ File.delete(i) if File.file?(i)
293
+ rescue Errno::EACCES => error
294
+ e 'Could not delete the file at '+i+' - reason '\
295
+ 'being insufficient permission.'
296
+ e 'The error was:'
297
+ e
298
+ pp error
299
+ e
300
+ end
301
+ end; alias delete_this_file delete_file # === delete_this_file
302
+
303
+ # ========================================================================= #
304
+ # === reset_the_internal_hash
305
+ # ========================================================================= #
306
+ def reset_the_internal_hash
307
+ # ======================================================================= #
308
+ # === @internal_hash
309
+ # ======================================================================= #
310
+ @internal_hash = {}
311
+ end
312
+
313
+ # ========================================================================= #
314
+ # === internal_hash?
315
+ # ========================================================================= #
316
+ def internal_hash?
317
+ @internal_hash
318
+ end; alias ihash? internal_hash? # === ihash?
319
+
320
+ # ========================================================================= #
321
+ # === log_dir?
322
+ # ========================================================================= #
323
+ def log_dir?
324
+ ::PdfParadise.log_dir?
325
+ end; alias log_directory? log_dir? # === log_directory?
326
+ alias temp_dir? log_dir? # === temp_dir?
327
+
328
+ # ========================================================================= #
329
+ # === mkdir
330
+ # ========================================================================= #
331
+ def mkdir(i)
332
+ FileUtils.mkdir_p(i)
333
+ end
334
+
335
+ # ========================================================================= #
336
+ # === try_to_ensure_that_this_directory_exists
337
+ # ========================================================================= #
338
+ def try_to_ensure_that_this_directory_exists(i)
339
+ unless File.directory?(i)
340
+ mkdir(i)
341
+ end
342
+ end
343
+
344
+ end; end
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/base/colours.rb'
6
+ # =========================================================================== #
7
+ require 'pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb'
8
+
9
+ module PdfParadise
10
+
11
+ class Base # === PdfParadise::Base
12
+
13
+ require 'pdf_paradise/colours/colours.rb'
14
+
15
+ if Object.const_defined?(:Colours) and Colours.const_defined?(:HtmlColoursMethods)
16
+ include ::Colours
17
+ include ::Colours::HtmlColoursMethods
18
+ def e(i = '')
19
+ puts i
20
+ end
21
+ else
22
+ include ::Colours
23
+ end
24
+
25
+ # ========================================================================= #
26
+ # === orange
27
+ # ========================================================================= #
28
+ def orange(i)
29
+ ::Colours.orange(i)
30
+ end
31
+
32
+ # ========================================================================= #
33
+ # === steelblue
34
+ # ========================================================================= #
35
+ def steelblue(i)
36
+ ::Colours::HtmlColoursMethods.steelblue(i)
37
+ end
38
+
39
+ # ========================================================================= #
40
+ # === gold
41
+ # ========================================================================= #
42
+ def gold(i)
43
+ ::Colours::HtmlColoursMethods.gold(i)
44
+ end
45
+
46
+ # ========================================================================= #
47
+ # === lightsteelblue
48
+ # ========================================================================= #
49
+ def lightsteelblue(i)
50
+ ::Colours::HtmlColoursMethods.lightsteelblue(i)
51
+ end
52
+
53
+ # ========================================================================= #
54
+ # === ecomment
55
+ # ========================================================================= #
56
+ def ecomment(i)
57
+ ::Colours.ecomment(i)
58
+ end
59
+
60
+ # ========================================================================= #
61
+ # === rev
62
+ # ========================================================================= #
63
+ def rev
64
+ ::Colours.rev
65
+ end
66
+
67
+ end; end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/colours/colours.rb'
6
+ # =========================================================================== #
7
+ module PdfParadise
8
+
9
+ begin
10
+ require 'colours/html_colours'
11
+ rescue LoadError; end
12
+
13
+ # ========================================================================= #
14
+ # === PdfParadise.darkolivegreen
15
+ # ========================================================================= #
16
+ def self.darkolivegreen(i = '')
17
+ ::Colours.darkolivegreen(i)
18
+ end
19
+
20
+ # ========================================================================= #
21
+ # === PdfParadise.rev
22
+ # ========================================================================= #
23
+ def self.rev
24
+ ::Colours.rev
25
+ end
26
+
27
+ end
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/commandline/commandline.rb'
6
+ # =========================================================================== #
7
+ module PdfParadise
8
+
9
+ # ========================================================================= #
10
+ # === @commandline_arguments
11
+ # ========================================================================= #
12
+ @commandline_arguments = []
13
+
14
+ # ========================================================================= #
15
+ # === PdfParadise.mega_check_every_pdf_file_in_the_current_directory
16
+ # ========================================================================= #
17
+ def self.mega_check_every_pdf_file_in_the_current_directory
18
+ require 'pdf_paradise/utility_scripts/check_syntax_of_pdf_files.rb'
19
+ PdfParadise::CheckSyntaxOfPdfFiles.new(:work_on_every_pdf_file_in_the_current_working_directory)
20
+ end
21
+
22
+ # ========================================================================= #
23
+ # === PdfParadise.set_commandline_arguments
24
+ # ========================================================================= #
25
+ def self.set_commandline_arguments(i)
26
+ i = [i].flatten.compact
27
+ # ======================================================================= #
28
+ # We will also check if a file with that name exists. If so we
29
+ # will replace it via File.absolute_path().
30
+ # ======================================================================= #
31
+ i.map! {|entry|
32
+ if File.exist?(entry)
33
+ entry = File.absolute_path(entry)
34
+ end
35
+ entry
36
+ }
37
+ @commandline_arguments = i
38
+ end
39
+
40
+ # ========================================================================= #
41
+ # === PdfParadise.commandline_arguments?
42
+ # ========================================================================= #
43
+ def self.commandline_arguments?
44
+ @commandline_arguments
45
+ end
46
+
47
+ # ========================================================================= #
48
+ # === @use_this_pdf_file
49
+ # ========================================================================= #
50
+ @use_this_pdf_file = nil
51
+
52
+ # ========================================================================= #
53
+ # === PdfParadise.set_use_this_pdf_file
54
+ # ========================================================================= #
55
+ def self.set_use_this_pdf_file(i)
56
+ @use_this_pdf_file = i.to_s.dup
57
+ end
58
+
59
+ # ========================================================================= #
60
+ # === PdfParadise.autoconvert_pdf_files_in_the_main_directory
61
+ # ========================================================================= #
62
+ def self.autoconvert_pdf_files_in_the_main_directory(
63
+ target = "#{AUTOCONVERT_PDF_FILES_RESIDING_IN_THIS_DIRECTORY}*.pdf"
64
+ )
65
+ require 'pdf_paradise/utility_scripts/split_pdf.rb'
66
+ all_pdf_files = Dir[target]
67
+ if all_pdf_files.empty?
68
+ e "No files found at #{target}."
69
+ else
70
+ all_pdf_files.each {|this_pdf_file|
71
+ PdfParadise.split_this_pdf_file(
72
+ this_pdf_file,
73
+ 1,
74
+ AUTOCONVERT_PDF_FILES_RESIDING_IN_THIS_DIRECTORY
75
+ )
76
+ }
77
+ end
78
+ end; self.instance_eval { alias autoconvert_pdf_files autoconvert_pdf_files_in_the_main_directory } # === PdfParadise.autoconvert_pdf_files
79
+
80
+ # ========================================================================= #
81
+ # === PdfParadise.open_the_default_pdf_files
82
+ #
83
+ # To invoke this method, do:
84
+ #
85
+ # pdfpa --open-pdf-files
86
+ #
87
+ # ========================================================================= #
88
+ def self.open_the_default_pdf_files(
89
+ use_this_file = ::PdfParadise.file_working_on_these_pdf_files
90
+ )
91
+ if File.exist? use_this_file
92
+ dataset = YAML.load_file(use_this_file)
93
+ dataset.each {|file|
94
+ esystem "atril #{file} &"
95
+ }
96
+ end
97
+ end
98
+
99
+ # ========================================================================= #
100
+ # === PdfParadise.start_the_most_important_libui_wrapper
101
+ # ========================================================================= #
102
+ def self.start_the_most_important_libui_wrapper(
103
+ optional_commandline_arguments = nil
104
+ )
105
+ require 'pdf_paradise/gui/libui/extract_all_images_from_this_pdf_file/extract_all_images_from_this_pdf_file.rb'
106
+ PdfParadise::GUI::LibUI::ExtractAllImagesFromThisPdfFile.new(optional_commandline_arguments)
107
+ end
108
+
109
+ end
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/commandline/help.rb'
6
+ # =========================================================================== #
7
+ module PdfParadise
8
+
9
+ # ========================================================================= #
10
+ # === PdfParadise.gold
11
+ # ========================================================================= #
12
+ def self.gold(i = '')
13
+ if Object.const_defined? :Colours
14
+ i = Colours.gold(i)
15
+ end
16
+ return i
17
+ end
18
+
19
+ # ========================================================================= #
20
+ # === PdfParadise.show_help
21
+ #
22
+ # Show the documented help options of the PdfParadise project.
23
+ #
24
+ # To invoke this method from the commandline, do:
25
+ #
26
+ # pdf_paradise --help
27
+ #
28
+ # ========================================================================= #
29
+ def self.show_help
30
+ e 'The available options are:'
31
+ e
32
+ e gold(' pdf_paradise --use-this-pdf-file=foobar.pdf --set_title="Hello world!"')
33
+ e
34
+ e " ^^^ this can be used to modify a .pdf's title"
35
+ e
36
+ e gold(' pdf_paradise --shrink-pdf-size-of=foobar.pdf')
37
+ e
38
+ e " ^^^ this can be used to shrinke a .pdf file"
39
+ e
40
+ e gold(' pdf_paradise --store-open-pdf-files')
41
+ e
42
+ e ' ^^^ store all currently open .pdf files into a local file.'
43
+ e
44
+ e gold(' pdf_paradise --open-last-pdf-files')
45
+ e
46
+ e ' ^^^ open the last opened .pdf files via a local PDF reader.'
47
+ e
48
+ e gold(' pdf_paradise --mega-checker') # === pdf_paradise --mega-checker
49
+ e
50
+ e ' ^^^ check every .pdf file in the current working directory for errors.'
51
+ e
52
+ e gold(' pdf_paradise --show_last_opened_pdf_files')
53
+ e
54
+ e ' ^^^ show which .pdf files were last open.'
55
+ e
56
+ e gold(' pdf_paradise --gui')
57
+ e gold(' pdf_paradise --gtk')
58
+ e
59
+ e ' ^^^ to start the ruby-gtk2 bindings for the pdf_paradise.'
60
+ e
61
+ e gold(' pdf_paradise --autoconvert')
62
+ e
63
+ e ' ^^^ to autoconvert all .pdf files in the main directory '\
64
+ 'into standalone .pdf files.'
65
+ e
66
+ e gold(' pdf_paradise --sinatra')
67
+ e
68
+ e ' ^^^ start the (minimal) sinatra-interface of the pdf_paradise '\
69
+ 'project'
70
+ e
71
+ e gold(' pdf_paradise --libui')
72
+ e
73
+ e ' ^^^ start the libui GUI'
74
+ e
75
+ end
76
+
77
+ end