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
@@ -0,0 +1,6 @@
1
+ This directory will contain code that can be used for various GUI
2
+ bindings, in particular ruby-gtk2 bindings.
3
+
4
+ There will probably be only a very few GUIs, though.
5
+
6
+ The directory fox/ refers to the fxruby bindings to the FOX toolkit.
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::Gtk::SplitPdfFile
6
+ #
7
+ # This is a simple fox-GUI wrapper over the split-pdf functionality
8
+ # of the PdfParadise project.
9
+ #
10
+ # In FOX we can use FXHorizontalFrame for horizontal alignment and
11
+ # FXVerticalFrame for vertical alignment.
12
+ # =========================================================================== #
13
+ # require 'pdf_paradise/gui/fox/split_pdf_file.rb'
14
+ # =========================================================================== #
15
+ require 'pdf_paradise'
16
+ require 'fox16'
17
+
18
+ module PdfParadise
19
+
20
+ module FOX
21
+
22
+ class SplitPdfFile < Fox::FXMainWindow # === PdfParadise::FOX::SplitPdfFile
23
+
24
+ alias e puts
25
+
26
+ # ========================================================================= #
27
+ # === initialize
28
+ # ========================================================================= #
29
+ def initialize(i)
30
+ super(
31
+ i,
32
+ 'Split Pdf',
33
+ width: 500, height: 250
34
+ )
35
+ # ======================================================================= #
36
+ # Separator
37
+ # ======================================================================= #
38
+ Fox::FXVerticalSeparator.new(self,
39
+ Fox::LAYOUT_SIDE_RIGHT|Fox::LAYOUT_FILL_Y|Fox::SEPARATOR_GROOVE)
40
+ statusbar = Fox::FXStatusBar.new(self,
41
+ Fox::LAYOUT_SIDE_BOTTOM|Fox::LAYOUT_FILL_X|Fox::STATUSBAR_WITH_DRAGCORNER
42
+ )
43
+ buttons = Fox::FXHorizontalFrame.new(self, Fox::LAYOUT_SIDE_BOTTOM|Fox::LAYOUT_FILL_X|Fox::PACK_UNIFORM_WIDTH)
44
+ button2 = Fox::FXButton.new(buttons, 'Input the 1')
45
+ button2.connect(Fox::SEL_COMMAND) {|sender, selector, event|
46
+ e 'HMM'
47
+ }
48
+ button3 = Fox::FXButton.new(buttons, '2')
49
+ button4 = Fox::FXButton.new(buttons, '3')
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === create
54
+ # ========================================================================= #
55
+ def create
56
+ super
57
+ show(Fox::PLACEMENT_SCREEN)
58
+ end
59
+
60
+ end; end
61
+
62
+ # =========================================================================== #
63
+ # === PdfParadise.start_fox_gui
64
+ # =========================================================================== #
65
+ def self.start_fox_gui
66
+ Fox::FXApp.new { |app|
67
+ PdfParadise::FOX::SplitPdfFile.new(app)
68
+ app.create
69
+ app.run
70
+ }
71
+ end
72
+
73
+ end
74
+
75
+ if __FILE__ == $PROGRAM_NAME
76
+ PdfParadise.start_fox_gui
77
+ end # start_fox_gui
@@ -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/gtk2/pdf_viewer/pdf_viewer.rb'
8
+ # PdfParadise::GUI::Gtk::PdfViewer.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk2'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class PdfViewer < ::Gtk::VBox
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 'pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb'
8
+ # PdfParadise::GUI::Gtk::SplitPdfFile.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk2'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class SplitPdfFile < ::Gtk::VBox
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/gtk2/statistics_widget/statistics_widget.rb'
8
+ # PdfParadise.return_widget_about_this_pdf_file
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk2.rb'
11
+
12
+ module PdfParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class StatisticsWidget < ::Gtk::VBox # === 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,214 @@
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
+ require 'gtk_paradise/toplevel_methods/toplevel_methods.rb'
27
+
28
+ # ========================================================================= #
29
+ # === NAMESPACE
30
+ # ========================================================================= #
31
+ NAMESPACE = inspect
32
+
33
+ # ========================================================================= #
34
+ # === TITLE
35
+ # ========================================================================= #
36
+ TITLE = '.pdf-related actions'
37
+
38
+ # ========================================================================= #
39
+ # === WIDTH
40
+ # ========================================================================= #
41
+ WIDTH = 1400
42
+
43
+ # ========================================================================= #
44
+ # === HEIGHT
45
+ # ========================================================================= #
46
+ HEIGHT = 1000
47
+
48
+ # ========================================================================= #
49
+ # === USE_THIS_FONT
50
+ # ========================================================================= #
51
+ USE_THIS_FONT = :dejavu_condensed_22
52
+
53
+ # ========================================================================= #
54
+ # === initialize
55
+ # ========================================================================= #
56
+ def initialize(
57
+ commandline_arguments = ARGV,
58
+ run_already = true
59
+ )
60
+ super(:horizontal)
61
+ reset
62
+ set_commandline_arguments(
63
+ commandline_arguments
64
+ )
65
+ run if run_already
66
+ end
67
+
68
+ # ========================================================================= #
69
+ # === reset (reset tag)
70
+ # ========================================================================= #
71
+ def reset
72
+ reset_the_internal_variables
73
+ # ======================================================================= #
74
+ # === @configuration
75
+ # ======================================================================= #
76
+ @configuration = [true, __dir__, NAMESPACE]
77
+ # ======================================================================= #
78
+ # === @title
79
+ # ======================================================================= #
80
+ @title = TITLE
81
+ # ======================================================================= #
82
+ # === @width
83
+ # ======================================================================= #
84
+ set_width(WIDTH)
85
+ # ======================================================================= #
86
+ # === @height
87
+ # ======================================================================= #
88
+ set_height(HEIGHT)
89
+ set_use_this_font(USE_THIS_FONT)
90
+ handle_CSS
91
+ infer_the_size_automatically
92
+ end
93
+
94
+ # ========================================================================= #
95
+ # === handle_CSS
96
+ # ========================================================================= #
97
+ def handle_CSS
98
+ use_gtk_paradise_project_css_file
99
+ apply_these_CSS_rules 'tooltip {
100
+ font-size: 24px;
101
+ padding: 12px;
102
+ margin: 12px;
103
+ border: 3px dotted steelblue;
104
+ }'
105
+ end
106
+
107
+ # ========================================================================= #
108
+ # === padding?
109
+ # ========================================================================= #
110
+ def padding?
111
+ 0
112
+ end
113
+
114
+ # ========================================================================= #
115
+ # === border_size?
116
+ # ========================================================================= #
117
+ def border_size?
118
+ 0
119
+ end
120
+
121
+ 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'
122
+ require 'pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb'
123
+ require 'pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb'
124
+ require 'pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb'
125
+ require 'pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb'
126
+
127
+ # ========================================================================= #
128
+ # === create_skeleton (create tag)
129
+ # ========================================================================= #
130
+ def create_skeleton
131
+ @notebook = gtk_notebook
132
+ # ======================================================================= #
133
+ # === 01
134
+ #
135
+ # Add the first tab.
136
+ # ======================================================================= #
137
+ tab_title = 'Statistics Widget'
138
+ @notebook.add_tab(
139
+ PdfParadise::GUI::Gtk::StatisticsWidget.new, title: tab_title
140
+ )
141
+ # ======================================================================= #
142
+ # === 02
143
+ #
144
+ # Add the second tab.
145
+ # ======================================================================= #
146
+ tab_title = 'Remove the first page of a .pdf file'
147
+ @notebook.add_tab(
148
+ ::PdfParadise.return_widget_remove_first_page_of_pdf_file,
149
+ title: tab_title
150
+ )
151
+ # ======================================================================= #
152
+ # === 03
153
+ #
154
+ # This is the "convert to .pdf" functionality.
155
+ # ======================================================================= #
156
+ tab_title = 'convert to .pdf'
157
+ @notebook.add_tab(
158
+ ::PdfParadise::GUI::Gtk::ToPdf.new,
159
+ title: tab_title
160
+ )
161
+ # ======================================================================= #
162
+ # === 04
163
+ #
164
+ # Add the fourth tab, for the split-pdf functionality.
165
+ # ======================================================================= #
166
+ tab_title = 'Split .pdf files'
167
+ @notebook.add_tab(
168
+ PdfParadise::GUI::Gtk::SplitPdfFile.new, title: tab_title
169
+ )
170
+ # ======================================================================= #
171
+ # === 05
172
+ # ======================================================================= #
173
+ tab_title = 'pdf-viewer'
174
+ @notebook.add_tab(
175
+ PdfParadise::GUI::Gtk::PdfViewer.new, title: tab_title
176
+ )
177
+ end
178
+
179
+ # ========================================================================= #
180
+ # === connect_skeleton (connect tag)
181
+ # ========================================================================= #
182
+ def connect_skeleton
183
+ abort_on_exception
184
+ minimal(
185
+ @notebook
186
+ )
187
+ end
188
+
189
+ # ========================================================================= #
190
+ # === run (run tag)
191
+ # ========================================================================= #
192
+ def run
193
+ create_skeleton_then_connect_skeleton
194
+ end
195
+
196
+ # ========================================================================= #
197
+ # === PdfParadise::GUI::Gtk::Controller.run
198
+ # ========================================================================= #
199
+ def self.run(
200
+ i = ARGV
201
+ )
202
+ require 'gtk_paradise/run'
203
+ _ = ::PdfParadise::GUI::Gtk::Controller.new(i)
204
+ r = ::Gtk.run
205
+ r << _
206
+ r.automatic_size_then_automatic_title
207
+ r.top_left_then_run
208
+ end
209
+
210
+ end; end; end; end
211
+
212
+ if __FILE__ == $PROGRAM_NAME
213
+ PdfParadise::GUI::Gtk::Controller.run
214
+ 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,167 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile
6
+ #
7
+ # Usage example:
8
+ #
9
+ # PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile.new(ARGV)
10
+ #
11
+ # =========================================================================== #
12
+ # require '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'
13
+ # PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile.new(ARGV)
14
+ # =========================================================================== #
15
+ require 'java'
16
+
17
+ java_import java.awt.Frame
18
+ java_import javax.swing.JFrame
19
+
20
+ module PdfParadise
21
+
22
+ module GUI
23
+
24
+ module Jruby
25
+
26
+ class DeleteTheFirstOrTheLastPageOfThisPdfFile < JFrame # === PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile
27
+
28
+ require 'pdf_paradise/gui/shared_code/delete_the_first_or_the_last_page_of_this_pdf_file_module/delete_the_first_or_the_last_page_of_this_pdf_file_module.rb'
29
+ include PdfParadise::GUI::DeleteTheFirstorTheLastPageOfThisPdfFileModule
30
+
31
+ require 'swing_paradise/base_module/base_module.rb'
32
+ include SwingParadise::BaseModule
33
+
34
+ # ========================================================================= #
35
+ # === HEIGHT
36
+ # ========================================================================= #
37
+ HEIGHT = 450
38
+
39
+ # ========================================================================= #
40
+ # === initialize
41
+ # ========================================================================= #
42
+ def initialize(
43
+ commandline_arguments = nil,
44
+ run_already = true
45
+ )
46
+ super('Delete the first or the last page of this pdf file')
47
+ reset
48
+ set_commandline_arguments(
49
+ commandline_arguments
50
+ )
51
+ run if run_already
52
+ end
53
+
54
+ # ========================================================================= #
55
+ # === reset (reset tag)
56
+ # ========================================================================= #
57
+ def reset
58
+ super() if respond_to?(:super)
59
+ reset_the_internal_hash
60
+ infer_the_namespace
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === return_right_frame
65
+ # ========================================================================= #
66
+ def return_right_frame
67
+ right_side = create_vbox # right tag
68
+ right_side.add(@button_remove_the_first_page_of_the_pdf_file)
69
+ right_side.add(@button_remove_the_last_page_of_the_pdf_file)
70
+ right_side.add(@button_remove_the_specified_page_of_the_pdf_file)
71
+ right_side.add(@button_pdf_viewer)
72
+ right_side.add(@button_file_chooser)
73
+ return right_side
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === open_file_chooser_dialog (open tag)
78
+ # ========================================================================= #
79
+ def open_file_chooser_dialog
80
+ current_directory = return_pwd
81
+ file_chooser = JFileChooser.new
82
+ # file_chooser.setFileSelectionMode(JFileChooser::DIRECTORIES_ONLY)
83
+
84
+ result = file_chooser.showOpenDialog(nil)
85
+ case result
86
+ when JFileChooser::APPROVE_OPTION
87
+ this_file = file_chooser.getSelectedFile.getAbsoluteFile.to_s
88
+ # this_file = File.absolute_path(this_file)
89
+ main_entry?.set_text(this_file)
90
+ end
91
+
92
+ end
93
+
94
+ # ========================================================================= #
95
+ # === create_the_skeleton (skeleton tag, create tag)
96
+ # ========================================================================= #
97
+ def create_the_skeleton
98
+ create_the_entries
99
+ create_the_buttons
100
+ create_the_labels
101
+ create_the_text_above_the_main_entry
102
+ create_the_checkboxes
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === run (run tag)
107
+ # ========================================================================= #
108
+ def run
109
+ create_the_skeleton
110
+ set_size(1200, HEIGHT)
111
+ panel = new_boxlayout(:new_panel)
112
+ panel.set_font(Font.new('Calibri', Font::PLAIN, 50))
113
+ panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))
114
+
115
+ entry1 = top_entry?
116
+ entry1.setAlignmentX(Component::CENTER_ALIGNMENT)
117
+
118
+ @text_above_the_main_entry.set_font(Font.new('Arial', Font::PLAIN, FONT_SIZE_LARGE))
119
+ _ = text(DENOTE_WHICH_PDF_PAGE_IS_TO_BE_REMOVED)
120
+ _.set_font(Font.new('Arial', Font::PLAIN, FONT_SIZE_LARGE))
121
+
122
+ mini_hbox = create_hbox
123
+ mini_hbox.add(@entry_remove_this_pdf_page)
124
+ mini_hbox.add(@button_remove_the_specified_page)
125
+
126
+ panel.batch_add( # left tag
127
+ @text_above_the_main_entry,
128
+ entry1,
129
+ _,
130
+ mini_hbox,
131
+ checkbox_shall_we_overwrite_the_original_pdf_file?,
132
+ create_and_then_return_the_label_that_shows_how_many_pages_are_in_the_given_pdf_file,
133
+ text_for_notifications?
134
+ )
135
+
136
+ panel_containing_two_child_widgets = create_boxlayout(:new_panel, BoxLayout::X_AXIS)
137
+ panel_containing_two_child_widgets.add(panel)
138
+ panel_containing_two_child_widgets.add(return_right_frame) # and this is the right tag
139
+ panel_containing_two_child_widgets.set_font(Font.new('Calibri', Font::PLAIN, FONT_SIZE_LARGE))
140
+ add(panel_containing_two_child_widgets, BorderLayout::NORTH)
141
+ do_parse_the_commandline_arguments
142
+ default_close
143
+ end
144
+
145
+ # ========================================================================= #
146
+ # === PdfParadise::GUI::DeleteTheFirstOrTheLastPageOfThisPdfFile[]
147
+ # ========================================================================= #
148
+ def self.[](i = ARGV)
149
+ new(i)
150
+ end
151
+
152
+ end; end; end
153
+
154
+ # =========================================================================== #
155
+ # === PdfParadise.start_the_jruby_interface_for_deleting_pages_of_a_pdf_file
156
+ # =========================================================================== #
157
+ def self.start_the_jruby_interface_for_deleting_pages_of_a_pdf_file
158
+ PdfParadise::GUI::Jruby::DeleteTheFirstOrTheLastPageOfThisPdfFile.new(ARGV).is_visible
159
+ end; self.instance_eval {
160
+ alias start_the_jruby_interface_for_deleting_pages_in_a_pdf_file start_the_jruby_interface_for_deleting_pages_of_a_pdf_file
161
+ } # === PdfParadise.start_the_jruby_interface_for_deleting_pages_in_a_pdf_file
162
+
163
+ end
164
+
165
+ if __FILE__ == $PROGRAM_NAME
166
+ PdfParadise.start_the_jruby_interface_for_deleting_pages_of_a_pdf_file
167
+ end # delete_the_first_or_the_last_page_of_this_pdf_file