pdf_paradise 0.1.66

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 (110) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +705 -0
  3. data/bin/automatic_pdf_title +7 -0
  4. data/bin/combine_these_pdf_pages +7 -0
  5. data/bin/compress_via_hexapdf +7 -0
  6. data/bin/convert_markdown_to_pdf +7 -0
  7. data/bin/convert_pdf_to_text +7 -0
  8. data/bin/delete_first_page_of_this_pdf_file +7 -0
  9. data/bin/merge_then_open +7 -0
  10. data/bin/n_pages +10 -0
  11. data/bin/open_main_pdf +7 -0
  12. data/bin/pdf_paradise +9 -0
  13. data/bin/set_main_book +7 -0
  14. data/bin/set_title_of_this_pdf_file +15 -0
  15. data/doc/README.gen +662 -0
  16. data/doc/todo/todo.md +7 -0
  17. data/lib/pdf_paradise/base/base.rb +239 -0
  18. data/lib/pdf_paradise/base/colours.rb +36 -0
  19. data/lib/pdf_paradise/commandline/commandline.rb +101 -0
  20. data/lib/pdf_paradise/commandline/help.rb +73 -0
  21. data/lib/pdf_paradise/commandline/menu.rb +142 -0
  22. data/lib/pdf_paradise/compress/compress_via_hexapdf.rb +27 -0
  23. data/lib/pdf_paradise/compress_this_pdf_file.rb +87 -0
  24. data/lib/pdf_paradise/constants/constants.rb +76 -0
  25. data/lib/pdf_paradise/convert_text_to_pdf.rb +94 -0
  26. data/lib/pdf_paradise/css/project.css +17 -0
  27. data/lib/pdf_paradise/djvu_to_pdf.rb +85 -0
  28. data/lib/pdf_paradise/gui/README.md +6 -0
  29. data/lib/pdf_paradise/gui/fox/split_pdf_file.rb +77 -0
  30. 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
  31. data/lib/pdf_paradise/gui/gtk2/pdf_viewer/pdf_viewer.rb +34 -0
  32. data/lib/pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb +34 -0
  33. data/lib/pdf_paradise/gui/gtk2/statistics_widget/statistics_widget.rb +34 -0
  34. data/lib/pdf_paradise/gui/gtk2/to_pdf/to_pdf.rb +32 -0
  35. data/lib/pdf_paradise/gui/gtk3/controller/controller.rb +212 -0
  36. data/lib/pdf_paradise/gui/gtk3/convert_pdf_to_text/convert_pdf_to_text.rb +34 -0
  37. 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
  38. data/lib/pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb +34 -0
  39. data/lib/pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb +34 -0
  40. data/lib/pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb +34 -0
  41. data/lib/pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb +32 -0
  42. data/lib/pdf_paradise/gui/libui/extract_all_images_from_this_pdf_file/extract_all_images_from_this_pdf_file.rb +223 -0
  43. data/lib/pdf_paradise/gui/libui/statistics_widget/statistics_widget.rb +233 -0
  44. data/lib/pdf_paradise/gui/shared_code/convert_pdf_to_text/convert_pdf_to_text_module.rb +277 -0
  45. 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 +443 -0
  46. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer.css +5 -0
  47. data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb +284 -0
  48. data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file.css +0 -0
  49. data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb +294 -0
  50. data/lib/pdf_paradise/gui/shared_code/statistics_widget/statistics_widget_module.rb +349 -0
  51. data/lib/pdf_paradise/gui/shared_code/to_pdf/to_pdf_module.rb +281 -0
  52. data/lib/pdf_paradise/hexapdf/001_rainbow_pattern_example.rb +0 -0
  53. data/lib/pdf_paradise/hexapdf/hexapdf.rb +123 -0
  54. data/lib/pdf_paradise/images/PDF_PARADISE_LOGO.png +0 -0
  55. data/lib/pdf_paradise/main_pdf/main_pdf.rb +444 -0
  56. data/lib/pdf_paradise/merge_pdf/menu.rb +63 -0
  57. data/lib/pdf_paradise/merge_pdf/merge_pdf.rb +306 -0
  58. data/lib/pdf_paradise/merge_pdf_namespace.rb +9 -0
  59. data/lib/pdf_paradise/merge_then_open/merge_then_open.rb +105 -0
  60. data/lib/pdf_paradise/pdf_file_n_total_pages.rb +249 -0
  61. data/lib/pdf_paradise/prawn_addons/README.md +2 -0
  62. data/lib/pdf_paradise/prawn_addons/prawn_addons.rb +17 -0
  63. data/lib/pdf_paradise/project/project.rb +22 -0
  64. data/lib/pdf_paradise/remove_pdf_password.rb +391 -0
  65. data/lib/pdf_paradise/requires/batch_require_toplevel_files.rb +22 -0
  66. data/lib/pdf_paradise/requires/colours.rb +7 -0
  67. data/lib/pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb +11 -0
  68. data/lib/pdf_paradise/requires/esystem_and_colours.rb +10 -0
  69. data/lib/pdf_paradise/requires/esystem_and_opn_and_colours.rb +8 -0
  70. data/lib/pdf_paradise/requires/require_the_whole_project.rb +28 -0
  71. data/lib/pdf_paradise/requires/require_utility_scripts.rb +9 -0
  72. data/lib/pdf_paradise/set_main_book.rb +156 -0
  73. data/lib/pdf_paradise/set_pdf_title.rb +220 -0
  74. data/lib/pdf_paradise/sinatra/embeddable_interface.rb +318 -0
  75. data/lib/pdf_paradise/toplevel_methods/automatic_pdf_title.rb +55 -0
  76. data/lib/pdf_paradise/toplevel_methods/convert_epub_to_pdf.rb +27 -0
  77. data/lib/pdf_paradise/toplevel_methods/convert_markdown_to_pdf.rb +45 -0
  78. data/lib/pdf_paradise/toplevel_methods/convert_ppt_to_pdf.rb +35 -0
  79. data/lib/pdf_paradise/toplevel_methods/e.rb +16 -0
  80. data/lib/pdf_paradise/toplevel_methods/esystem.rb +19 -0
  81. data/lib/pdf_paradise/toplevel_methods/misc.rb +76 -0
  82. data/lib/pdf_paradise/toplevel_methods/number_pages.rb +38 -0
  83. data/lib/pdf_paradise/toplevel_methods/opened_pdf_files.rb +221 -0
  84. data/lib/pdf_paradise/toplevel_methods/query_pdf_title.rb +191 -0
  85. data/lib/pdf_paradise/toplevel_methods/reduce_size_of_this_pdf_file.rb +46 -0
  86. data/lib/pdf_paradise/toplevel_methods/roebe.rb +17 -0
  87. data/lib/pdf_paradise/toplevel_methods/rotate_pdf_file.rb +143 -0
  88. data/lib/pdf_paradise/toplevel_methods/to_pdf.rb +38 -0
  89. data/lib/pdf_paradise/utility_scripts/README.md +3 -0
  90. data/lib/pdf_paradise/utility_scripts/combine_these_pdf_pages.rb +118 -0
  91. data/lib/pdf_paradise/utility_scripts/convert_pdf_to_text.rb +175 -0
  92. data/lib/pdf_paradise/utility_scripts/delete_first_page_of_this_pdf_file.rb +221 -0
  93. data/lib/pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb +180 -0
  94. data/lib/pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb +329 -0
  95. data/lib/pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb +129 -0
  96. data/lib/pdf_paradise/utility_scripts/extract_pdf_page.rb +283 -0
  97. data/lib/pdf_paradise/utility_scripts/pdf_optimizer.rb +111 -0
  98. data/lib/pdf_paradise/utility_scripts/pdf_statistics.rb +148 -0
  99. data/lib/pdf_paradise/utility_scripts/pdf_to_html.rb +75 -0
  100. data/lib/pdf_paradise/utility_scripts/remove_images.rb +110 -0
  101. data/lib/pdf_paradise/utility_scripts/split_pdf.rb +340 -0
  102. data/lib/pdf_paradise/utility_scripts/to_qdf.rb +82 -0
  103. data/lib/pdf_paradise/version/version.rb +19 -0
  104. data/lib/pdf_paradise/www/README.md +2 -0
  105. data/lib/pdf_paradise/www/sinatra/app.rb +276 -0
  106. data/lib/pdf_paradise/yaml/working_on_these_pdf_files.yml +4 -0
  107. data/lib/pdf_paradise.rb +5 -0
  108. data/pdf_paradise.gemspec +61 -0
  109. data/test/testing_pdf_paradise.rb +9 -0
  110. metadata +219 -0
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::Controller
6
+ #
7
+ # This widget simply aggregates the other ruby-gtk widgets that are part
8
+ # of the pdf-paradise project.
9
+ # =========================================================================== #
10
+ # require 'pdf_paradise/gui/gtk3/controller/controller.rb'
11
+ # PdfParadise::GUI::Gtk::Controller.run
12
+ # =========================================================================== #
13
+ require 'gtk_paradise/require_gtk3'
14
+
15
+ module PdfParadise
16
+
17
+ module GUI
18
+
19
+ module Gtk
20
+
21
+ class Controller < ::Gtk::Box # === PdfParadise::GUI::Gtk::Controller
22
+
23
+ require 'gtk_paradise/requires/require_the_base_module.rb'
24
+ include ::Gtk::BaseModule
25
+
26
+ # ========================================================================= #
27
+ # === NAMESPACE
28
+ # ========================================================================= #
29
+ NAMESPACE = inspect
30
+
31
+ # ========================================================================= #
32
+ # === TITLE
33
+ # ========================================================================= #
34
+ TITLE = '.pdf-related actions'
35
+
36
+ # ========================================================================= #
37
+ # === WIDTH
38
+ # ========================================================================= #
39
+ WIDTH = 1400
40
+
41
+ # ========================================================================= #
42
+ # === HEIGHT
43
+ # ========================================================================= #
44
+ HEIGHT = 1000
45
+
46
+ # ========================================================================= #
47
+ # === USE_THIS_FONT
48
+ # ========================================================================= #
49
+ USE_THIS_FONT = :dejavu_condensed_22
50
+
51
+ # ========================================================================= #
52
+ # === initialize
53
+ # ========================================================================= #
54
+ def initialize(
55
+ commandline_arguments = ARGV,
56
+ run_already = true
57
+ )
58
+ super(:horizontal)
59
+ reset
60
+ set_commandline_arguments(
61
+ commandline_arguments
62
+ )
63
+ run if run_already
64
+ end
65
+
66
+ # ========================================================================= #
67
+ # === reset (reset tag)
68
+ # ========================================================================= #
69
+ def reset
70
+ reset_the_internal_variables
71
+ # ======================================================================= #
72
+ # === @configuration
73
+ # ======================================================================= #
74
+ @configuration = [true, __dir__, NAMESPACE]
75
+ # ======================================================================= #
76
+ # === @title
77
+ # ======================================================================= #
78
+ @title = TITLE
79
+ # ======================================================================= #
80
+ # === @width
81
+ # ======================================================================= #
82
+ set_width(WIDTH)
83
+ # ======================================================================= #
84
+ # === @height
85
+ # ======================================================================= #
86
+ set_height(HEIGHT)
87
+ set_use_this_font(USE_THIS_FONT)
88
+ handle_CSS
89
+ infer_the_size_automatically
90
+ end
91
+
92
+ # ========================================================================= #
93
+ # === handle_CSS
94
+ # ========================================================================= #
95
+ def handle_CSS
96
+ use_gtk_paradise_project_css_file
97
+ apply_these_CSS_rules 'tooltip {
98
+ font-size: 24px;
99
+ padding: 12px;
100
+ margin: 12px;
101
+ border: 3px dotted steelblue;
102
+ }'
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === padding?
107
+ # ========================================================================= #
108
+ def padding?
109
+ 0
110
+ end
111
+
112
+ # ========================================================================= #
113
+ # === border_size?
114
+ # ========================================================================= #
115
+ def border_size?
116
+ 0
117
+ end
118
+
119
+ require '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'
120
+ require 'pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb'
121
+ require 'pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb'
122
+ require 'pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb'
123
+ require 'pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb'
124
+
125
+ # ========================================================================= #
126
+ # === create_skeleton (create tag)
127
+ # ========================================================================= #
128
+ def create_skeleton
129
+ @notebook = gtk_notebook
130
+ # ======================================================================= #
131
+ # === 01
132
+ #
133
+ # Add the first tab.
134
+ # ======================================================================= #
135
+ tab_title = 'Statistics Widget'
136
+ @notebook.add_tab(
137
+ PdfParadise::GUI::Gtk::StatisticsWidget.new, title: tab_title
138
+ )
139
+ # ======================================================================= #
140
+ # === 02
141
+ #
142
+ # Add the second tab.
143
+ # ======================================================================= #
144
+ tab_title = 'Remove the first page of a .pdf file'
145
+ @notebook.add_tab(
146
+ ::PdfParadise.return_widget_remove_first_page_of_pdf_file,
147
+ title: tab_title
148
+ )
149
+ # ======================================================================= #
150
+ # === 03
151
+ #
152
+ # This is the "convert to .pdf" functionality.
153
+ # ======================================================================= #
154
+ tab_title = 'convert to .pdf'
155
+ @notebook.add_tab(
156
+ ::PdfParadise::GUI::Gtk::ToPdf.new,
157
+ title: tab_title
158
+ )
159
+ # ======================================================================= #
160
+ # === 04
161
+ #
162
+ # Add the fourth tab, for the split-pdf functionality.
163
+ # ======================================================================= #
164
+ tab_title = 'Split .pdf files'
165
+ @notebook.add_tab(
166
+ PdfParadise::GUI::Gtk::SplitPdfFile.new, title: tab_title
167
+ )
168
+ # ======================================================================= #
169
+ # === 05
170
+ # ======================================================================= #
171
+ tab_title = 'pdf-viewer'
172
+ @notebook.add_tab(
173
+ PdfParadise::GUI::Gtk::PdfViewer.new, title: tab_title
174
+ )
175
+ end
176
+
177
+ # ========================================================================= #
178
+ # === connect_skeleton (connect tag)
179
+ # ========================================================================= #
180
+ def connect_skeleton
181
+ abort_on_exception
182
+ minimal(
183
+ @notebook
184
+ )
185
+ end
186
+
187
+ # ========================================================================= #
188
+ # === run (run tag)
189
+ # ========================================================================= #
190
+ def run
191
+ create_skeleton_then_connect_skeleton
192
+ end
193
+
194
+ # ========================================================================= #
195
+ # === PdfParadise::GUI::Gtk::Controller.run
196
+ # ========================================================================= #
197
+ def self.run(
198
+ i = ARGV
199
+ )
200
+ require 'gtk_paradise/run'
201
+ _ = ::PdfParadise::GUI::Gtk::Controller.new(i)
202
+ r = ::Gtk.run
203
+ r << _
204
+ r.automatic_size_then_automatic_title
205
+ r.top_left_then_run
206
+ end
207
+
208
+ end; end; end; end
209
+
210
+ if __FILE__ == $PROGRAM_NAME
211
+ PdfParadise::GUI::Gtk::Controller.run
212
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::ConvertPdfToText
6
+ # =========================================================================== #
7
+ # require 'pdf_paradise/gui/gtk3/convert_pdf_to_text/convert_pdf_to_text.rb'
8
+ # PdfParadise::GUI::Gtk::ConvertPdfToText.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class ConvertPdfToText < ::Gtk::Box
19
+
20
+ require 'pdf_paradise/gui/shared_code/convert_pdf_to_text/convert_pdf_to_text_module.rb'
21
+ include ::PdfParadise::GUI::Gtk::ConvertPdfToTextModule
22
+
23
+ # ========================================================================= #
24
+ # === PdfParadise::GUI::Gtk::ConvertPdfToText.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::PdfParadise::GUI::Gtk::ConvertPdfToTextModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ PdfParadise::GUI::Gtk::ConvertPdfToText.run
34
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile
6
+ #
7
+ # This is a simple gtk-GUI wrapper over the remove-first-page and the
8
+ # remove-last-page functionality of the PdfParadise project. The
9
+ # main box is a VBox (vertical box).
10
+ # =========================================================================== #
11
+ # require 'pdf_paradise/gui/gtk3/remove_first_page_of_pdf_file.rb'
12
+ # PdfParadise.return_widget_remove_first_page_of_pdf_file
13
+ # PdfParadise.start_gtk_gui_remove_first_page_of_pdf_file
14
+ # =========================================================================== #
15
+ require 'gtk_paradise/require_gtk3'
16
+
17
+ module PdfParadise
18
+
19
+ module GUI
20
+
21
+ module Gtk
22
+
23
+ class DeleteTheFirstOrTheLastPageOfThisPdfFile < ::Gtk::Box # === PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile
24
+
25
+ require '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'
26
+ include ::PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFileModule
27
+
28
+ # ========================================================================= #
29
+ # === PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFile.run
30
+ # ========================================================================= #
31
+ def self.run
32
+ ::PdfParadise::GUI::Gtk::DeleteTheFirstOrTheLastPageOfThisPdfFileModule.run
33
+ end
34
+
35
+ end; end; end; end
36
+
37
+ if __FILE__ == $PROGRAM_NAME
38
+ PdfParadise.start_gtk_gui_remove_first_page_of_pdf_file
39
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::PdfViewer
6
+ # =========================================================================== #
7
+ # require 'pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb'
8
+ # PdfParadise::GUI::Gtk::PdfViewer.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class PdfViewer < ::Gtk::Box
19
+
20
+ require 'pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb'
21
+ include ::PdfParadise::GUI::Gtk::PdfViewerModule
22
+
23
+ # ========================================================================= #
24
+ # === PdfParadise::GUI::Gtk::PdfViewer.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::PdfParadise::GUI::Gtk::PdfViewerModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ PdfParadise::GUI::Gtk::PdfViewer.run
34
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::SplitPdfFile
6
+ # =========================================================================== #
7
+ # require 'foobar/gui/gtk3/split_pdf_file/split_pdf_file.rb'
8
+ # PdfParadise::GUI::Gtk::SplitPdfFile.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class SplitPdfFile < ::Gtk::Box
19
+
20
+ require 'pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb'
21
+ include ::PdfParadise::GUI::Gtk::SplitPdfFileModule
22
+
23
+ # ========================================================================= #
24
+ # === PdfParadise::GUI::Gtk::SplitPdfFile.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::PdfParadise::GUI::Gtk::SplitPdfFileModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ PdfParadise::GUI::Gtk::SplitPdfFile.run
34
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Gtk::StatisticsWidget
6
+ # =========================================================================== #
7
+ # require 'pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb'
8
+ # PdfParadise.return_widget_about_this_pdf_file
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3.rb'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class StatisticsWidget < ::Gtk::Box # === PdfParadise::GUI::Gtk::StatisticsWidget
19
+
20
+ require 'pdf_paradise/gui/shared_code/statistics_widget/statistics_widget_module.rb'
21
+ include ::PdfParadise::GUI::Gtk::StatisticsWidgetModule
22
+
23
+ # ========================================================================= #
24
+ # === PdfParadise::GUI::Gtk::StatisticsWidget.run
25
+ # ========================================================================= #
26
+ def self.run
27
+ ::PdfParadise::GUI::Gtk::StatisticsWidgetModule.run
28
+ end
29
+
30
+ end; end; end; end
31
+
32
+ if __FILE__ == $PROGRAM_NAME
33
+ PdfParadise.start_gtk_gui_statistics_widget
34
+ end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb'
6
+ # PdfParadise::GUI::Gtk::ToPdf.new
7
+ # =========================================================================== #
8
+ require 'gtk_paradise/require_gtk3'
9
+
10
+ module PdfParadise
11
+
12
+ module GUI
13
+
14
+ module Gtk
15
+
16
+ class ToPdf < ::Gtk::Box # === PdfParadise::Gtk::ToPdf
17
+
18
+ require 'pdf_paradise/gui/shared_code/to_pdf/to_pdf_module.rb'
19
+ include ::PdfParadise::GUI::Gtk::ToPdfModule
20
+
21
+ # ========================================================================= #
22
+ # === PdfParadise::GUI::Gtk::ToPdf.run
23
+ # ========================================================================= #
24
+ def self.run(i = ARGV)
25
+ ::PdfParadise::GUI::Gtk::ToPdfModule.run(i)
26
+ end
27
+
28
+ end; end; end; end
29
+
30
+ if __FILE__ == $PROGRAM_NAME
31
+ PdfParadise::GUI::Gtk::ToPdf.run(ARGV)
32
+ end
@@ -0,0 +1,223 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::LibUI::ExtractAllImagesFromThisPdfFile
6
+ # =========================================================================== #
7
+ # require 'pdf_paradise/gui/libui/extract_all_images_from_this_pdf_file/extract_all_images_from_this_pdf_file.rb'
8
+ # PdfParadise::GUI::LibUI::ExtractAllImagesFromThisPdfFile.new
9
+ # =========================================================================== #
10
+ module PdfParadise
11
+
12
+ module GUI
13
+
14
+ module LibUI
15
+
16
+ class ExtractAllImagesFromThisPdfFile # === PdfParadise::GUI::LibUI::ExtractAllImagesFromThisPdfFile
17
+
18
+ require 'fileutils'
19
+ require 'pdf_paradise/toplevel_methods/misc.rb'
20
+ require 'pdf_paradise/utility_scripts/extract_all_images_from_this_pdf_file.rb'
21
+
22
+ alias e puts
23
+
24
+ require 'libui_paradise'
25
+ include LibuiParadise::Extensions
26
+
27
+ # ========================================================================= #
28
+ # === TITLE
29
+ # ========================================================================= #
30
+ TITLE = 'Extract all images from this .pdf file'
31
+
32
+ # ========================================================================= #
33
+ # === WIDTH
34
+ # ========================================================================= #
35
+ WIDTH = 800
36
+
37
+ # ========================================================================= #
38
+ # === HEIGHT
39
+ # ========================================================================= #
40
+ HEIGHT = 680
41
+
42
+ # ========================================================================= #
43
+ # === initialize
44
+ #
45
+ # This class will not make use of ARGV by default, so you have to
46
+ # pass it in on your own.
47
+ # ========================================================================= #
48
+ def initialize(
49
+ optional_commandline_arguments = [],
50
+ run_already = true
51
+ )
52
+ reset
53
+ @commandline_arguments = [optional_commandline_arguments].flatten.compact
54
+ run if run_already
55
+ end
56
+
57
+ # ========================================================================= #
58
+ # === reset (reset tag)
59
+ # ========================================================================= #
60
+ def reset
61
+ title_width_height(TITLE, WIDTH, HEIGHT)
62
+ # ======================================================================= #
63
+ # === @_
64
+ # ======================================================================= #
65
+ @_ = PdfParadise::ExtractAllImagesFromThisPdfFile.new(:do_not_run_yet)
66
+ end
67
+
68
+ # ========================================================================= #
69
+ # === create_skeleton (create tag, skeleton tag)
70
+ # ========================================================================= #
71
+ def create_skeleton
72
+ # ======================================================================= #
73
+ # === @window
74
+ # ======================================================================= #
75
+ @window = ui_padded_main_window(title?, width?, height?, 0)
76
+ create_the_entries
77
+ end
78
+
79
+ # ========================================================================= #
80
+ # === create_the_entries
81
+ # ========================================================================= #
82
+ def create_the_entries
83
+ # ======================================================================= #
84
+ # === @entry_work_on_this_pdf_file
85
+ # ======================================================================= #
86
+ @entry_work_on_this_pdf_file = entry
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === main_entry?
91
+ # ========================================================================= #
92
+ def main_entry?
93
+ @entry_work_on_this_pdf_file
94
+ end
95
+
96
+ # ========================================================================= #
97
+ # === return_the_file_open_button
98
+ # ========================================================================= #
99
+ def return_the_file_open_button
100
+ button_open_file = button('Open file')
101
+ button_open_file.on_clicked {
102
+ begin
103
+ filename = ui_open_file(@window).to_s # This is the part that will open a local file.
104
+ if filename and !filename.empty?
105
+ filename = File.absolute_path(filename)
106
+ main_entry?.set_text(filename)
107
+ end
108
+ rescue Exception
109
+ end
110
+ }
111
+ return button_open_file
112
+ end
113
+
114
+ # ========================================================================= #
115
+ # === run
116
+ # ========================================================================= #
117
+ def run
118
+ log_dir = PdfParadise.log_dir?
119
+ unless File.directory? log_dir
120
+ begin
121
+ FileUtils.mkdir_p(log_dir)
122
+ rescue LoadError; end
123
+ end
124
+ PdfParadise.cd_to_the_log_directory
125
+ create_skeleton_then_connect_skeleton
126
+ outer_vbox = padded_vbox
127
+ # ======================================================================= #
128
+ # First add the two buttons on top:
129
+ # ======================================================================= #
130
+ button_do_extract = ui_button('Extract the images')
131
+ button_do_extract.on_clicked {
132
+ do_extract_the_pdf_file
133
+ }
134
+ outer_vbox.add_hsep
135
+
136
+ grid = ui_padded_grid
137
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
138
+ grid.ui_grid_append(text('Work on this .pdf file → '), 0, 0, 1, 1, 0, 0.5, 0, 0)
139
+ grid.ui_grid_append(main_entry?, 1, 0, 2, 1, 1, 0.5, 0, 0)
140
+
141
+ grid.hash_grid(
142
+ button_do_extract,
143
+ left: 0,
144
+ top: 1,
145
+ xspan: 1,
146
+ yspan: 1,
147
+ hexpand: 0,
148
+ halign: 0.5,
149
+ vexpand: 0,
150
+ valign: 0
151
+ )
152
+ grid.hash_grid(
153
+ return_the_file_open_button,
154
+ left: 1,
155
+ top: 1,
156
+ xspan: 1,
157
+ yspan: 1,
158
+ hexpand: 0,
159
+ halign: 0.5,
160
+ vexpand: 0,
161
+ valign: 0
162
+ )
163
+ grid.hash_grid(
164
+ text('Current working directory: '+return_pwd),
165
+ left: 2,
166
+ top: 1,
167
+ xspan: 1,
168
+ yspan: 1,
169
+ hexpand: 0,
170
+ halign: 0.5,
171
+ vexpand: 0,
172
+ valign: 0
173
+ )
174
+ outer_vbox.minimal(grid, 0)
175
+ outer_vbox.add_hsep
176
+ outer_vbox.minimal(quit_button)
177
+ outer_vbox.add_hsep
178
+ ::LibuiParadise.set_main_window(@window)
179
+ do_parse_the_commandline_arguments
180
+ @window.add(outer_vbox)
181
+ @window.intelligent_exit
182
+ end
183
+
184
+ # ========================================================================= #
185
+ # === do_parse_the_commandline_arguments
186
+ # ========================================================================= #
187
+ def do_parse_the_commandline_arguments
188
+ _ = @commandline_arguments
189
+ if _ and _.is_a?(Array) and !_.empty?
190
+ _.each {|entry|
191
+ if File.exist? entry
192
+ set_work_on_this_file(entry)
193
+ end
194
+ }
195
+ end
196
+ end
197
+
198
+ # ========================================================================= #
199
+ # === set_work_on_this_file
200
+ # ========================================================================= #
201
+ def set_work_on_this_file(i)
202
+ @entry_work_on_this_pdf_file.set_text(i)
203
+ end
204
+
205
+ # ========================================================================= #
206
+ # === do_extract_the_pdf_file
207
+ # ========================================================================= #
208
+ def do_extract_the_pdf_file(
209
+ this_pdf_file = @entry_work_on_this_pdf_file.text?
210
+ )
211
+ @_.do_extract_the_pdf_file(this_pdf_file)
212
+ LibuiParadise.message_box(
213
+ 'If everything went fine then you should now be able '\
214
+ 'to see all extracted images in the '\
215
+ 'directory `'+return_pwd+'`.'
216
+ )
217
+ end
218
+
219
+ end; end; end; end
220
+
221
+ if __FILE__ == $PROGRAM_NAME
222
+ PdfParadise::GUI::LibUI::ExtractAllImagesFromThisPdfFile.new
223
+ end