pdf_paradise 0.3.20

Sign up to get free protection for your applications and to get access to all the features.
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,219 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::LibUI::RotatePdfFile
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::RotatePdfFile.new
9
+ # =========================================================================== #
10
+ module PdfParadise
11
+
12
+ module GUI
13
+
14
+ module LibUI
15
+
16
+ class RotatePdfFile # === PdfParadise::GUI::LibUI::RotatePdfFile
17
+
18
+ require 'fileutils'
19
+ require 'pdf_paradise/toplevel_methods/misc.rb'
20
+
21
+ require 'pdf_paradise/utility_scripts/rotate_pdf_file.rb'
22
+
23
+ alias e puts
24
+
25
+ require 'libui_paradise'
26
+ include LibuiParadise::Extensions
27
+
28
+ # ========================================================================= #
29
+ # === TITLE
30
+ # ========================================================================= #
31
+ TITLE = 'Rotate .pdf file'
32
+
33
+ # ========================================================================= #
34
+ # === WIDTH
35
+ # ========================================================================= #
36
+ WIDTH = 800
37
+
38
+ # ========================================================================= #
39
+ # === HEIGHT
40
+ # ========================================================================= #
41
+ HEIGHT = 680
42
+
43
+ # ========================================================================= #
44
+ # === initialize
45
+ # ========================================================================= #
46
+ def initialize(
47
+ optional_commandline_arguments = [],
48
+ run_already = true
49
+ )
50
+ reset
51
+ @commandline_arguments = [optional_commandline_arguments].flatten.compact
52
+ run if run_already
53
+ end
54
+
55
+ # ========================================================================= #
56
+ # === reset (reset tag)
57
+ # ========================================================================= #
58
+ def reset
59
+ title_width_height(TITLE, WIDTH, HEIGHT)
60
+ # ======================================================================= #
61
+ # === @_
62
+ # ======================================================================= #
63
+ @_ = PdfParadise::RotatePdfFile.new(:do_not_run_yet)
64
+ end
65
+
66
+ # ========================================================================= #
67
+ # === create_skeleton (create tag, skeleton tag)
68
+ # ========================================================================= #
69
+ def create_skeleton
70
+ # ======================================================================= #
71
+ # === @window
72
+ # ======================================================================= #
73
+ @window = ui_padded_main_window(title?, width?, height?, 0)
74
+ create_the_entries
75
+ end
76
+
77
+ # ========================================================================= #
78
+ # === create_the_entries
79
+ # ========================================================================= #
80
+ def create_the_entries
81
+ # ======================================================================= #
82
+ # === @entry_work_on_this_pdf_file
83
+ # ======================================================================= #
84
+ @entry_work_on_this_pdf_file = entry
85
+ end
86
+
87
+ # ========================================================================= #
88
+ # === main_entry?
89
+ # ========================================================================= #
90
+ def main_entry?
91
+ @entry_work_on_this_pdf_file
92
+ end
93
+
94
+ # ========================================================================= #
95
+ # === return_the_file_open_button
96
+ # ========================================================================= #
97
+ def return_the_file_open_button
98
+ button_open_file = button('Open file')
99
+ button_open_file.on_clicked {
100
+ begin
101
+ filename = ui_open_file(@window).to_s # This is the part that will open a local file.
102
+ if filename and !filename.empty?
103
+ filename = File.absolute_path(filename)
104
+ main_entry?.set_text(filename)
105
+ end
106
+ rescue Exception
107
+ end
108
+ }
109
+ return button_open_file
110
+ end
111
+
112
+ # ========================================================================= #
113
+ # === do_rotate_the_pdf_file
114
+ # ========================================================================= #
115
+ def do_rotate_the_pdf_file(
116
+ this_pdf_file = @entry_work_on_this_pdf_file.text?
117
+ )
118
+ PdfParadise.cd_to_the_log_dir # Make sure we are in the log dir.
119
+ @_.do_rotate_the_pdf_file(this_pdf_file) # , :be_quiet)
120
+ LibuiParadise.message_box(
121
+ 'If everything went fine then you should now be able '\
122
+ 'to see the newly rotated .pdf file in the '\
123
+ 'directory `'+return_pwd+'`.'+
124
+ "\n\nFull path should be at:\n\n"\
125
+ " #{return_pwd.strip}#{rotated_pdf_file_.pdf}\n"
126
+ )
127
+ end
128
+
129
+ # ========================================================================= #
130
+ # === run
131
+ # ========================================================================= #
132
+ def run
133
+ PdfParadise.ensure_that_the_log_directory_exists
134
+ PdfParadise.cd_to_the_log_directory
135
+ create_skeleton_then_connect_skeleton
136
+ outer_vbox = padded_vbox
137
+ # ======================================================================= #
138
+ # First add the two buttons on top:
139
+ # ======================================================================= #
140
+ button_do_extract = ui_button('Rotate the .pdf file')
141
+ button_do_extract.on_clicked {
142
+ do_rotate_the_pdf_file
143
+ }
144
+ outer_vbox.add_hsep
145
+
146
+ grid = ui_padded_grid
147
+ # widget, left, top, xspan, yspan, hexpand, halign, vexpand, valign
148
+ grid.ui_grid_append(text('Work on this .pdf file → '), 0, 0, 1, 1, 0, 0.5, 0, 0)
149
+ grid.ui_grid_append(main_entry?, 1, 0, 2, 1, 1, 0.5, 0, 0)
150
+
151
+ grid.hash_grid(
152
+ button_do_extract,
153
+ left: 0,
154
+ top: 1,
155
+ xspan: 1,
156
+ yspan: 1,
157
+ hexpand: 0,
158
+ halign: 0.5,
159
+ vexpand: 0,
160
+ valign: 0
161
+ )
162
+ grid.hash_grid(
163
+ return_the_file_open_button,
164
+ left: 1,
165
+ top: 1,
166
+ xspan: 1,
167
+ yspan: 1,
168
+ hexpand: 0,
169
+ halign: 0.5,
170
+ vexpand: 0,
171
+ valign: 0
172
+ )
173
+ grid.hash_grid(
174
+ text('Current working directory: '+return_pwd),
175
+ left: 2,
176
+ top: 1,
177
+ xspan: 1,
178
+ yspan: 1,
179
+ hexpand: 0,
180
+ halign: 0.5,
181
+ vexpand: 0,
182
+ valign: 0
183
+ )
184
+ outer_vbox.minimal(grid, 0)
185
+ outer_vbox.add_hsep
186
+ outer_vbox.minimal(quit_button)
187
+ outer_vbox.add_hsep
188
+ ::LibuiParadise.set_main_window(@window)
189
+ do_parse_the_commandline_arguments
190
+ @window.add(outer_vbox)
191
+ @window.intelligent_exit
192
+ end
193
+
194
+ # ========================================================================= #
195
+ # === do_parse_the_commandline_arguments
196
+ # ========================================================================= #
197
+ def do_parse_the_commandline_arguments
198
+ _ = @commandline_arguments
199
+ if _ and _.is_a?(Array) and !_.empty?
200
+ _.each {|entry|
201
+ if File.exist? entry
202
+ set_work_on_this_file(entry)
203
+ end
204
+ }
205
+ end
206
+ end
207
+
208
+ # ========================================================================= #
209
+ # === set_work_on_this_file
210
+ # ========================================================================= #
211
+ def set_work_on_this_file(i)
212
+ @entry_work_on_this_pdf_file.set_text(i)
213
+ end
214
+
215
+ end; end; end; end
216
+
217
+ if __FILE__ == $PROGRAM_NAME
218
+ PdfParadise::GUI::LibUI::RotatePdfFile.new
219
+ end
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === PdfParadise::GUI::Libui::StatisticsWidget
6
+ # =========================================================================== #
7
+ # require 'pdf_paradise/gui/libui/statistics_widget/statistics_widget.rb'
8
+ # PdfParadise::GUI::Libui::StatisticsWidget.new
9
+ # =========================================================================== #
10
+ module PdfParadise
11
+
12
+ module GUI
13
+
14
+ module Libui
15
+
16
+ class StatisticsWidget # === PdfParadise::GUI::Libui::StatisticsWidget
17
+
18
+ require 'libui_paradise/autoinclude'
19
+
20
+ require 'pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb'
21
+ require 'pdf_paradise/toplevel_methods/automatic_pdf_title.rb'
22
+ require 'pdf_paradise/toplevel_methods/query_pdf_title.rb'
23
+
24
+ begin
25
+ require 'colours'
26
+ rescue LoadError; end
27
+
28
+ # ========================================================================= #
29
+ # === TITLE
30
+ # ========================================================================= #
31
+ TITLE = 'Show statistics about the .pdf file at hand'
32
+
33
+ # ========================================================================= #
34
+ # === initialize
35
+ # ========================================================================= #
36
+ def initialize
37
+ reset
38
+ create_skeleton
39
+ # ======================================================================= #
40
+ # === @main_window
41
+ # ======================================================================= #
42
+ @main_window = ui_main_window(
43
+ TITLE, 560, 240, 0
44
+ )
45
+ outer_vbox = ui_padded_vbox
46
+
47
+ # ======================================================================= #
48
+ # === First row
49
+ # ======================================================================= #
50
+ hbox = ui_padded_hbox
51
+ @button_auto_title = ui_button('Automatic Title')
52
+ @button_auto_title.on_clicked {
53
+ do_automatically_determine_the_title_for_the_pdf_file_at_hand
54
+ }
55
+ hbox.minimal(@button_auto_title)
56
+ @button_open_via_a_pdf_reader = ui_button('Open via a pdf-reader')
57
+ @button_open_via_a_pdf_reader.on_clicked {
58
+ do_open_the_local_pdf_file_in_the_pdf_reader
59
+ }
60
+ hbox.minimal(@button_open_via_a_pdf_reader)
61
+ hbox.minimal(ui_quit_button)
62
+ outer_vbox.minimal(hbox)
63
+
64
+ # ======================================================================= #
65
+ # === Second row
66
+ # ======================================================================= #
67
+ outer_vbox.minimal(
68
+ text(
69
+ 'This small widget will show some information about '\
70
+ 'the .pdf file at hand.'
71
+ )
72
+ )
73
+ # ======================================================================= #
74
+ # === Third row
75
+ # ======================================================================= #
76
+ hbox = ui_padded_hbox
77
+ hbox.minimal(left_arrow?)
78
+ hbox.maximal(@entry_use_this_pdf_file)
79
+ outer_vbox.maximal(hbox)
80
+
81
+ # ======================================================================= #
82
+ # === Fourth row
83
+ # ======================================================================= #
84
+ hbox = ui_padded_hbox
85
+ button_open_file = ui_button('Open File')
86
+ button_open_file.on_clicked {
87
+ begin
88
+ @filename = ui_open_file(@main_window).to_s # This is the part that will open a local file.
89
+ rescue Exception => error
90
+ @filename = nil # To prevent "Null pointer given" errors.
91
+ # =================================================================== #
92
+ # The error specifically is:
93
+ #
94
+ # #<ArgumentError: NULL pointer given>
95
+ #
96
+ # =================================================================== #
97
+ end
98
+ if @filename and File.exist?(@filename)
99
+ @entry_use_this_pdf_file.set_text(@filename)
100
+ end
101
+ }
102
+ hbox.minimal(button_open_file)
103
+ # ======================================================================= #
104
+ # === button_analyse_the_pdf_file
105
+ # ======================================================================= #
106
+ button_analyse_the_pdf_file = ui_button('Analyse the .pdf file')
107
+ button_analyse_the_pdf_file.on_clicked {
108
+ e 'TODO Analyse the pdf file'
109
+ }
110
+ hbox.minimal(button_analyse_the_pdf_file)
111
+ outer_vbox.minimal(hbox)
112
+
113
+ # ======================================================================= #
114
+ # === Fifth row
115
+ # ======================================================================= #
116
+ @label = ui_text
117
+ outer_vbox.minimal(@label)
118
+ @main_window.child = outer_vbox
119
+ @main_window.intelligent_exit
120
+ end
121
+
122
+ # ========================================================================= #
123
+ # === reset (reset tag)
124
+ # ========================================================================= #
125
+ def reset
126
+ # ======================================================================= #
127
+ # === @filename
128
+ # ======================================================================= #
129
+ @filename = nil
130
+ end
131
+
132
+ # ========================================================================= #
133
+ # === create_skeleton
134
+ # ========================================================================= #
135
+ def create_skeleton
136
+ create_all_entries
137
+ create_all_buttons
138
+ end
139
+
140
+ # ========================================================================= #
141
+ # === create_all_entries
142
+ # ========================================================================= #
143
+ def create_all_entries
144
+ # ======================================================================= #
145
+ # === @entry_use_this_pdf_file
146
+ # ======================================================================= #
147
+ @entry_use_this_pdf_file = ui_entry
148
+ end
149
+
150
+ # ========================================================================= #
151
+ # === main_entry?
152
+ # ========================================================================= #
153
+ def main_entry?
154
+ @entry_use_this_pdf_file
155
+ end
156
+
157
+ # ========================================================================= #
158
+ # === do_automatically_determine_the_title_for_the_pdf_file_at_hand
159
+ # ========================================================================= #
160
+ def do_automatically_determine_the_title_for_the_pdf_file_at_hand(
161
+ this_pdf_file = main_entry?.text?
162
+ )
163
+ if this_pdf_file and !this_pdf_file.empty?
164
+ ::PdfParadise.automatic_pdf_title(this_pdf_file)
165
+ do_analyse_the_pdf_file
166
+ else
167
+ popup_over_this_widget(
168
+ @main_window,
169
+ 'Please first assign a .pdf file, before '\
170
+ 'this functionality can be used.'
171
+ )
172
+ end
173
+ end
174
+
175
+ # ========================================================================= #
176
+ # === do_analyse_the_pdf_file
177
+ #
178
+ # This is the method that will analyse the .pdf file at hand.
179
+ # ========================================================================= #
180
+ def do_analyse_the_pdf_file(
181
+ this_pdf_file = main_entry?.text.to_s
182
+ )
183
+ _ = ''.dup
184
+ _ << "This .pdf file has the following characteristics:\n\n"
185
+ _ << ' <b>n pages</b>: '+::PdfParadise.n_pages?(this_pdf_file).to_s
186
+ _ << "\n"
187
+ use_this_title = ::PdfParadise.title?(this_pdf_file).to_s
188
+ if use_this_title.empty?
189
+ use_this_title = '(This .pdf file has no title)'
190
+ end
191
+ _ << " <b>title</b>: #{use_this_title}"
192
+ _ << "\n"
193
+ @label.set_text(_)
194
+ end
195
+
196
+ # ========================================================================= #
197
+ # === do_open_the_local_pdf_file_in_the_pdf_reader
198
+ # ========================================================================= #
199
+ def do_open_the_local_pdf_file_in_the_pdf_reader(
200
+ this_pdf_file = main_entry?.text?
201
+ )
202
+ if this_pdf_file and !this_pdf_file.empty?
203
+ Thread.new {
204
+ esystem("evince #{this_pdf_file}")
205
+ }
206
+ else
207
+ popup_over_this_widget(
208
+ @main_window,
209
+ 'Please first assign a .pdf file, before '\
210
+ 'this functionality can be used.'
211
+ )
212
+ end
213
+ end
214
+
215
+ # ========================================================================= #
216
+ # === esystem
217
+ # ========================================================================= #
218
+ def esystem(i)
219
+ e i
220
+ system i
221
+ end
222
+
223
+ # ========================================================================= #
224
+ # === create_all_buttons
225
+ # ========================================================================= #
226
+ def create_all_buttons
227
+ end
228
+
229
+ end; end; end; end
230
+
231
+ if __FILE__ == $PROGRAM_NAME
232
+ PdfParadise::GUI::Libui::StatisticsWidget.new
233
+ end
@@ -0,0 +1,5 @@
1
+ #button1 {
2
+ border: 3px solid darkblue;
3
+ color: teal;
4
+ background: oldlace;
5
+ }