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/README.gen ADDED
@@ -0,0 +1,871 @@
1
+ DEFAULT_HEADER
2
+
3
+ <img src="https://i.imgur.com/unhKNEw.png" style="margin-left: 2em">
4
+ <img src="https://i.imgur.com/xMrkTJM.png" style="margin-left: 1em">
5
+
6
+ This project can help with pdf-related activities, such as extracting
7
+ a .pdf page, converting .pdf page, merging .pdf files, splitting
8
+ .pdf files, setting the title of a .pdf page and similar actions.
9
+
10
+ The project has to remain quite flexible. We may use external programs
11
+ such as **ghoscript** or **qpdf**, or we may use pure ruby solutions,
12
+ such as via the gem called <b>combine_pdf</b>, <b>prawn</b> or
13
+ <b>hexapdf</b>.
14
+
15
+ The file here (README.gen, respectively the generated file called
16
+ **README.md**), will describe some of the components that make up
17
+ this gem.
18
+
19
+ ## Rationale for making use of separate pdf-related projects
20
+
21
+ There are many different pdf-related toolkits available if you look
22
+ for them on the <b>www</b>.
23
+
24
+ For example, we have <b>prawn</b>, we have <b>qpdf</b>, we have
25
+ <b>calibre</b>, we have <b>hexapdf</b>, we have
26
+ <b>ghostscript</b>, and many more applications.
27
+
28
+ Some of these projects have unique features; and some of them have
29
+ overlapping functionality, such as reading the content of .pdf files
30
+ in a simplified manner (number of pages, title, author and so
31
+ forth).
32
+
33
+ The PdfParadise project attempts to support as many different
34
+ (open-source) projects as possible. From the point of view of
35
+ the PdfParadise project, it is also permissive to <b>support
36
+ closed source projects</b>, provided that **the code remains
37
+ simple** (and simple to change), for instance via ruby's
38
+ system / `` callbacks for commandline binaries.
39
+
40
+ The primary focus for the pdf_paradise gem is on open-source
41
+ projects, though, so closed-source is a secondary objective,
42
+ at best.
43
+
44
+ Why does the PdfParadise project attempt to support many different
45
+ pdf-related projects?
46
+
47
+ The answer to this question is rather simple: on Linux I have a <b>lot</b>
48
+ of flexibility and can use literally any pdf-related project just fine.
49
+ On Windows, however had, I am more restricted in what I can use. Not
50
+ all programs are available on windows or can be easily compiled or
51
+ be installed there. Thus, in order to allow the pdf_paradise .gem
52
+ to work on windows, we need a certain level of flexibility.
53
+
54
+ The reason why I added this subsection here in <b>June 2021</b> was that
55
+ I am slowly changing the sinatra-related part of the PdfParadise
56
+ project, in order to embed the functionality into my main controller
57
+ which is handled by the **Roebe** namespace. In that controller
58
+ I wanted to easily <b>offer pdf-related functionality</b>
59
+ "out of the box" when I start the sinatra-application on windows.
60
+ Because I want to be able to offer pdf-related modifications on
61
+ windows as well, the PdfParadise project had to become more
62
+ flexible, so that a simple toplevel route, such as **/pdf**, will
63
+ work properly, and lead to entry points (subroutes) that allow
64
+ me to tap into the features offered by the PdfParadise project.
65
+ That way I can then, for instance, easily display the number of
66
+ pages in a .pdf file on windows as well.
67
+
68
+ So, the primary **summary** here is this: <b>the PdfParadise project must
69
+ remain flexible in order to support a proper workflow on windows
70
+ systems as well</b>. (We could use WSL on windows, but not every
71
+ computer has this available, so I am targeting "vanilla" windows
72
+ really.)
73
+
74
+ Note that one slight drawback is that the sinatra part of
75
+ the PdfParadise project now has <b>a dependency</b> on the
76
+ **cyberweb** project, so if you want to use that, you also
77
+ have to install the cyberweb gem. This is a trade-off - for me
78
+ the more important part is long-term maintainability of
79
+ the pdf_paradise project in the long run, so a unified
80
+ code base had to be used in this regard.
81
+
82
+ ## Converting a .pdf file to text
83
+
84
+ Sometimes you may wish to have a text-file describing the content of
85
+ a .pdf file, rather than the .pdf file itself.
86
+
87
+ Via class **PdfParadise::ConvertPdfToText**, residing in the file at
88
+ **pdf_paradise/convert_pdf_to_text.rb**, you can convert a .pdf file
89
+ to a text file.
90
+
91
+ Usage example from ruby, for the file called **foobar.pdf**:
92
+
93
+ PdfParadise::ConvertPdfToText.new(ARGV)
94
+ PdfParadise::ConvertPdfToText.new('foobar.pdf')
95
+
96
+ You can also use the bin/ file from the commandline:
97
+
98
+ convert_pdf_to_text
99
+ convert_pdf_to_text foobar.pdf
100
+
101
+ There is also a ruby-gtk3 widget that offers the functionality
102
+ from class **PdfParadise::ConvertPdfToText**, if the user
103
+ has gtk3 installed and the ruby-bindings to it as well.
104
+
105
+ You can start that ruby-gtk3 widget via:
106
+
107
+ convert_pdf_to_text --gui
108
+
109
+ ## Storing the .pdf pages that are currently open
110
+
111
+ If you need to store the .pdf files that are currently open, you
112
+ can use the following commandline to do so:
113
+
114
+ pdfparadise --store-open-pdf-files
115
+
116
+ This will attempt to store the full path to the .pdf files
117
+ into a local file. That way you may also be able to batch-open
118
+ these .pdf files at a later time, e. g. when you switch your
119
+ window manager or after a reboot.
120
+
121
+ Since as of October 2022 I am not using this as much anymore as
122
+ before, because the <b>roebe</b> gem has a class called Books
123
+ (at <b>roebe/classes/books.rb</b>) that handles .pdf files for
124
+ me. I use that class as if I am reading different "books" - each
125
+ individual .pdf file is then a "book".
126
+
127
+ ## Converting markdown .md files to .pdf files
128
+
129
+ If you use kramdown, prawn and kramdown-pdf-converter, then you
130
+ can convert .md files on the commandline, via:
131
+
132
+ convert_markdown_to_pdf path_to_pdf_file_goes_here.pdf
133
+
134
+ Install the necessary gems prior to using this commandline
135
+ functionality.
136
+
137
+ ## Querying the title of a .pdf file
138
+
139
+ <b>class PdfParadise::QueryPdfTitle</b> will report the title of
140
+ any .pdf file that is passed into it, on the commandline.
141
+
142
+ This currently depends on <b>exiftool</b> but at a later time,
143
+ this may change to also allow a query via prawn or other tools.
144
+
145
+ If you need to determine whether a given .pdf file has a title
146
+ or whether it does not, you can use
147
+ <b>PdfParadise.does_this_pdf_file_have_a_title?</b>, such
148
+ as in:
149
+
150
+ PdfParadise.does_this_pdf_file_have_a_title? "foobar.pdf" # => true
151
+
152
+ This method will return **true** if the .pdf file at hand has a
153
+ title; and **false** otherwise.
154
+
155
+ ## Determining how many pages a given .pdf file has
156
+
157
+ class **PdfParadise::PdfFileNTotalPages** can be used to query
158
+ how many pages a given .pdf file has.
159
+
160
+ The executable called **bin/n_pages** (thus, **n_pages**) can
161
+ be used to query this, on the commandline.
162
+
163
+ Example:
164
+
165
+ n_pages foobar.pdf
166
+
167
+ Do note that the class requires the external program
168
+ called **pdfinfo**.
169
+
170
+ It is possible to query the number of pages in a given .pdf
171
+ file without **pdfinfo**, but some .pdf files are a bit buggy,
172
+ and **pdfinfo** is simply more reliable than the regex that
173
+ was used until March 2020. So, past March 2020, the program
174
+ **pdfinfo** is now used by default. Note that pdfinfo is
175
+ part of the poppler software suite.
176
+
177
+ You can also use the following toplevel API for this:
178
+
179
+ PdfParadise.n_pages? 'THE_PATH_TO_THE_PDF_FILE_GOES_IN_HERE.pdf'
180
+ PdfParadise.n_pages? 'foobar.pdf'
181
+
182
+ ## Adding page numbers to .pdf files
183
+
184
+ Via the combine_pdf gem it is now possible to add page numbers
185
+ to .pdf files. This has a few limitations for complex .pdf files,
186
+ due to combine_pdf having limitations in turn - but for simple
187
+ .pdf files this should work really well.
188
+
189
+ How to use that functionality?
190
+
191
+ Consider using the following toplevel API:
192
+
193
+ PdfParadise.number_pages('this_file.pdf')
194
+
195
+ The file called **this_file.pdf** has to exist in order for
196
+ this to work, of course.
197
+
198
+ The current default is to display the page numbers on the bottom
199
+ right side. This is hardcoded, but you could modify the code
200
+ to adapt to your needs; see also how combine_pdf does this.
201
+ (You have to pass an option-hash.)
202
+
203
+ ## Various GUI component of the PdfParadise project
204
+
205
+ The **PdfParadise project** comes with some ruby-gtk3 specific
206
+ GUIs, but a few ruby-gtk2 and ruby-tk bindings may exist
207
+ as well. The **ruby-gtk3** components constitute the main GUI
208
+ elements of this project, though.
209
+
210
+ You can start, from the commandline, the gtk-wrapper
211
+ over the **split_pdf_file** functionality.
212
+
213
+ In order to do this, do either one of the following:
214
+
215
+ pdf_paradise --gui
216
+ pdf_paradise --gtk
217
+
218
+ This will require the **gtk_paradise** project and the gtk
219
+ bindings, so quite a lot. **gem install gtk3** and
220
+ **gem install gtk_paradise** should help.
221
+
222
+ The GUI for class SplitPdfFile is called **PdfParadise::Gtk::SplitPdfFile**.
223
+ The idea behind it is to allow you to determine some of the parameters
224
+ in a graphical fashion.
225
+
226
+ Since as of **September 2019**, there is also a mini-widget for quickly
227
+ removing the first page of a .pdf file. This is really minimal right
228
+ now and not very elegant; it may be improved in the future, but for
229
+ the time being it is what it is. It is more a proof-of-concept that
230
+ it can work.
231
+
232
+ You can start this via:
233
+
234
+ require 'pdf_paradise/gui/gtk2/remove_first_page_of_pdf_file.rb'
235
+
236
+ PdfParadise.start_gtk_gui_remove_first_page_of_pdf_file
237
+
238
+ Note that as of **January 2021** the gtk bindings will default to
239
+ **ruby-gtk3**. Support for ruby-gtk2 will be retained, though,
240
+ but new code may not necessarily be written for ruby-gtk2 in
241
+ mind. ruby-gtk3 is now the main GUI target for this project.
242
+
243
+ I am slowly porting the individual widgets.
244
+
245
+ The following widgets have been ported so far:
246
+
247
+ PdfParadise::GUI::Gtk::StatisticsWidget # can be found under pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb
248
+
249
+ ## Specification of the .pdf format
250
+
251
+ This subsection is a stub - I only needed it to gather information
252
+ about the .pdf specification. This is NOT complete - it only shall
253
+ contain some useful information and snippets about the .pdf
254
+ specification.
255
+
256
+ PDF stands short for **Portable Document Format**.
257
+
258
+ PDF has been standardized as **ISO-32000** in the year **2008**.
259
+
260
+ In the pdf-specification we can distinguish these entities:
261
+
262
+ Objects: these are not objects in the OOP sense, but simply the
263
+ basic data type of the PDF standard. There are 9 types of objects:
264
+ null, boolean, integer, real, name, string, array, dictionary and
265
+ stream.
266
+
267
+ Dictionary: this is a key-value pair that is unordered. They are
268
+ denoted by << and >> at the beginning and the end.
269
+
270
+ Indirect Objects: these are objects that are referred to by
271
+ reference.
272
+
273
+ Direct Objects: these are objects that appear inline and are
274
+ obtained directly.
275
+
276
+ Conforming Reader: is ann application that parses a PDF
277
+ file according to the PDF Standard.
278
+
279
+ A .pdf file is made up of a specific structure, usually a four-part
280
+ layout.
281
+
282
+ These four parts are:
283
+
284
+ Header
285
+ Body
286
+ Cross-reference table
287
+ Trailer
288
+
289
+ ### The .pdf Header tag
290
+
291
+ The header may begin with an entry such as **%PDF-1.7**.
292
+
293
+ The general format for the header is:
294
+
295
+ %PDF- followed by the version number in the form of 1.N.
296
+
297
+ This is not valid for all .pdf files, though. Past PDF Version
298
+ 1.4, the **Version** entry in the document's catalog dictionary,
299
+ which is within the **Root** entry of the **Trailer**, may be
300
+ used instead of the Header - **if present**.
301
+
302
+ If a .pdf file contains binary data - which most PDF files
303
+ will do nowadays, such as **stream objects** - then the
304
+ **Header** line shall be immediately followed by a line
305
+ containing at the least **four binary characters**. These
306
+ are character codes of 128 or greater.
307
+
308
+ ### The .pdf Body tag
309
+
310
+ The body of a PDF File consist of these aforementioned **Indirect
311
+ Objects** representing the contents of a document.
312
+
313
+ **Indirect Objects** begin with a **unique object identifier**
314
+ that allows other objects to refer to them.
315
+
316
+ That identifier is made up of the following two components:
317
+
318
+ (1) Object Number: a positive Integer, can be in any arbitrary order
319
+ (2) Generation Number: a non-negative Integer)
320
+
321
+ The **Indirect Objects** can be referred to from elsewhere by an
322
+ Indirect Reference. This must consist of:
323
+
324
+ Object Number
325
+ Generation Number, and
326
+ keyword R # for instance: 4 0 R
327
+
328
+ After the identifier is the keyword **obj** (start of the object)
329
+ and **endobj** (end of the object). Anything in between that is
330
+ is a key-value pair that describes the object.
331
+
332
+ A a simple example showing the use of **Indirect Objects** will be
333
+ shown next:
334
+
335
+ 1 0 obj % Object Number 1, Generation Number 0
336
+ <<
337
+ /Type /Pages % Describe type of object
338
+ /Kids [ 4 0 R ] $ Kids Entry referring to an indirect reference (Object number 4, Generation number 0)
339
+ /Count 1
340
+ >>
341
+ endobj
342
+
343
+ 2 0 obj % Object Number 2, Generation Number 0
344
+ <<
345
+ /Type /Catalog % Describe type of object
346
+ /Pages 1 0 R % Referring another object via unique object identifier
347
+ >>
348
+ endobj
349
+
350
+ The **Body** section of a .pdf file is thus a tree of objects that
351
+ are linked together, ultimately coming down to the Root Object
352
+ (Defined by the **Root** entry in the **Trailer** section, as a
353
+ catalog dictionary).
354
+
355
+ The **Cross-Reference Table** is a table that contains a list of byte
356
+ offset pointing to the indirect objects.
357
+
358
+ A pdf-conforming reader uses the Cross-Reference Table as a lookup
359
+ table to access certain objects quickly when needed.
360
+
361
+ The format for entries in Cross-Reference Table can be summarized ass
362
+ follows:
363
+
364
+ - In the following format nnnnnnnnnn ggggg n eol, a total of 20 bytes
365
+ - nnnnnnnnnn is a 10-digit byte offset in the decoded stream
366
+ - ggggg 5-digit generation number
367
+ - n keyword for in-use entry or f keyword for free entry
368
+ - eol 2 character end-of-line sequence (Like CR LF)
369
+
370
+ The **Cross-Reference Table** always begins with the special entry
371
+ **0000000000 65535** - see the following example:
372
+
373
+ 0000000000 65535 f % special entry, f denoting it is a free entry
374
+
375
+ ## Graphical User Interfaces (GUIs)
376
+
377
+ The pdf_paradise gem comes with a few, small-ish widgets, primarily
378
+ written in ruby-gtk. Since as of August 2021 I am also experimenting
379
+ with libui but this is a slow process - stay tuned for more updates
380
+ in the coming months in this regard.
381
+
382
+ One big advantage of libui is that it works on windows out-of-the-box,
383
+ so we can use GUIs on windows as well. \o/
384
+
385
+ ## Storing all open .pdf files in a yaml file
386
+
387
+ In **February 2022* the yaml file working_on_these_pdf_files.yml
388
+ was added at:
389
+
390
+ pdf_paradise/yaml/working_on_these_pdf_files.yml
391
+
392
+ The idea here is that this yaml-file retains the local path
393
+ to any .pdf file that the user (in this case me) is working
394
+ on, aka reading right now.
395
+
396
+ I needed this because I tend to work through .pdf files and
397
+ remove page after page when I read it. The idea is that
398
+ I do not lose that information when I reboot my computer
399
+ or when said computer crashes; I needed to make this
400
+ persistent information.
401
+
402
+ Why is this yaml file part of the pdf_paradise gem, though?
403
+ This is mostly due to convenience. I wanted to have this
404
+ available in one of my ruby gems by default. In the long
405
+ run I will add code that allows other users to adjust
406
+ this to their own use case (and perhaps in their home
407
+ directory rather than store this in the gem itself). As
408
+ of February 2022 code for the latter is currently not
409
+ part of the gem, but I may add code for this - either
410
+ in the **pdf_paradise** gem or the **roebe** gem.
411
+
412
+ ## Splitting a single pdf file into individual several .pdf files
413
+
414
+ You can use the following toplevel API to split up a single
415
+ .pdf file into several .pdf files:
416
+
417
+ PdfParadise.burst(ARGV)
418
+ PdfParadise.burst('foobar.pdf')
419
+
420
+ A commandline variant exists as well, at <b>bin/burst_this_pdf_file</b>,
421
+ tapping into the code stored in the file
422
+ <b>pdf_paradise/utility_scripts/split_pdf.rb</b>.
423
+
424
+ Usage example for the commandline variant:
425
+
426
+ burst_this_pdf_file foobar.pdf
427
+
428
+ (Make sure this bin file can be found in <b>$PATH</b>.)
429
+
430
+ Be careful when using this script: it will dump the generated
431
+ individual .pdf files into the current working directory, so
432
+ you may want to create a subdirectory before invoking this
433
+ executable, and move your target .pdf into that file. While
434
+ functionality could be added to automatically create a
435
+ subdirectory and relocate the generated .pdf files into
436
+ that subdirectory, for now we'll keep it simple here and
437
+ just extract the individual .pdf pages into the current
438
+ working directory.
439
+
440
+ Note that <b>hexapdf</b> can also be used for this functionality.
441
+ In February 2023 it became the default; the old variant
442
+ via imagemagick's convert is retained in the file
443
+ <b>pdf_paradise/utility_scripts/split_pdf.rb</b> though.
444
+
445
+ ## Merging pdf files
446
+
447
+ <b>class PdfParadise::MergePdf.new(ARGV)</b> can be used for
448
+ <b>merging .pdf files</b>. This functionality depends on
449
+ external software, so you have to install this first.
450
+
451
+ Currently <b>ghostscript</b> and <b>hexapdf</b> can be used for
452
+ the <b>merging</b> step.
453
+
454
+ Examples for how to use either of these two variants, as
455
+ far as <b>class PdfParadise::MergePdf</b> is concerned,
456
+ follows next:
457
+
458
+ mergepdf one.pdf two.pdf --use-ghostscript
459
+ mergepdf one.pdf two.pdf --use-hexapdf
460
+ mergepdf *.avif --use-hexapdf
461
+ mergepdf SCAN1.avif SCAN2.avif SCAN3.avif SCAN4.avif SCAN5.avif --use-hexapdf
462
+ mergepdf SCAN1.avif SCAN2.avif SCAN3.avif SCAN4.avif SCAN5.avif --use-ghostscript
463
+ mergepdf output-page1.pdf output-page2.pdf output-page3.pdf output-page4.pdf output-page5.pdf --use-ghostscript
464
+ mergepdf SCAN1_GUTACHTEN.pdf SCAN2_GUTACHTEN.pdf SCAN3_GUTACHTEN.pdf SCAN4_GUTACHTEN.pdf SCAN5_GUTACHTEN.pdf --use-ghostscript
465
+ mergepdf SCAN1_GUTACHTEN.pdf SCAN2_GUTACHTEN.pdf SCAN3_GUTACHTEN.pdf SCAN4_GUTACHTEN.pdf SCAN5_GUTACHTEN.pdf --hexapdf
466
+
467
+ (The two -- hyphen are mandatory for commandline arguments right now; otherwise
468
+ it is assumed to be a locally existing .pdf file.)
469
+
470
+ If you need to do this from within ruby code, consider
471
+ using the following code:
472
+
473
+ require 'pdf_paradise'
474
+ merge_pdf = PdfParadise::MergePdf.new('one.pdf two.pdf')
475
+ merge_pdf.feedback_where_it_is_stored # Call it manually.
476
+
477
+ require 'pdf_paradise'
478
+ merge_pdf = PdfParadise::MergePdf.new('one.pdf two.pdf')
479
+ merge_pdf.feedback_where_it_is_stored # Call it manually.
480
+
481
+ ## Combining individual pages from .pdf files into a new .pdf file via class PdfParadise::CombineThesePdfPages
482
+
483
+ class **PdfParadise::CombineThesePdfPages** can be used to
484
+ extract individual pdf pages from a given .pdf file and
485
+ combine these into a new .pdf file.
486
+
487
+ There is also an executable at **bin/combine_these_pdf_pages**
488
+ which can be used on the commandline.
489
+
490
+ This functionality depends on the **hexapdf** gem.
491
+
492
+ Usage example:
493
+
494
+ combine_these_pdf_pages foobar.pdf 3,4,5
495
+
496
+ This would retain the pages at 3, 4 and 5 and create a new
497
+ .pdf file.
498
+
499
+ ## Extracting all images from a .pdf file
500
+
501
+ If you make use of <b>poppler</b> then you can extract
502
+ all images from a given .pdf file.
503
+
504
+ A small libui-GUI was added for this functionality - this
505
+ is mostly for quick demo purposes. It does not work extremely
506
+ well.
507
+
508
+ On IceWM it looks like this right now:
509
+
510
+ <img src="https://i.imgur.com/QXelVyy.png" style="margin:1em">
511
+
512
+ Not pretty, but it took only about 20 minutes to write this.
513
+
514
+ <b>pdfimages</b> from poppler must be installed. On Windows
515
+ you can probably download an executable for poppler here:
516
+
517
+ https://blog.alivate.com.au/poppler-windows/
518
+
519
+ I tested whether the above executables work on windows, and
520
+ indeed, they still work fine. I also tested the libui
521
+ variant on windows, and it works. The code is a bit
522
+ brittle, so use with care, but I was able to use it
523
+ successfully on <b>August 2022</b> to extract all images
524
+ from a given .pdf file. At a later time I may add am
525
+ to-image converter via libui, probably in the other
526
+ gem called image_paradise. Stay tuned in this regard.
527
+
528
+ To start the libui wrapper from the commandline, you can
529
+ use the following:
530
+
531
+ /usr/bin/pdf_paradise --libui
532
+ bin/pdf_paradise --libui
533
+ pdf_paradise --libui # This variant should work, or try the other
534
+ # variants; it is stored in bin/pdf_paradise
535
+ # of this gem
536
+
537
+ ## Numbering the pages in a given .pdf file automatically
538
+
539
+ If you use the external gem called <b>combine_pdf</b> then you can
540
+ make use of automatic numbering via the pdf_paradise gem.
541
+
542
+ The API for this is:
543
+
544
+ PdfParadise.number_this_pdf_file('foobar.pdf')
545
+
546
+ It is not a very flexible API as of right now. Perhaps at a later
547
+ point in time it may be extended.
548
+
549
+ ## class PdfParadise::ToPdf
550
+
551
+ class <b>PdfParadise::ToPdf</b> can be used for two main
552
+ activities right now:
553
+
554
+ (1) You can convert .docx to .pdf files on the commandline, if you
555
+ have libreoffice installed.
556
+
557
+ (2) If you pass in a directory, then all image files of that
558
+ directory will be gathered, converted into a .pdf file, and
559
+ then the .pdf file will be assembled.
560
+
561
+ ## The sinatra interface of the pdf_paradise gem
562
+
563
+ Since as of April 2019 there is a minimal sinatra interface to the
564
+ PdfParadise project. Consider this incomplete <b>work-in-progress</b>.
565
+
566
+ To start it, try:
567
+
568
+ pdf_paradise --sinatra
569
+
570
+ Since as of <b>July 2023</b> this now makes use of class <b>Cyberweb::HtmlTemplate</b>.
571
+ This is the generic class I use for generating HTML files (or rather, the
572
+ String that describes the .html file in question).
573
+
574
+ ## Flipping / Rotating a .pdf file
575
+
576
+ This subsection will try to explain how a .pdf file can be flipped / rotated,
577
+ and how this may relate to the <b>pdf_paradise</b> gem here.
578
+
579
+ There are many ways how to do so. Let's start with an example via <b>qpdf</b>.
580
+
581
+ To rotate clockwise, 90°, use:
582
+
583
+ qpdf --rotate=+90 foo.pdf bar.pdf
584
+
585
+ This will generate a flipped .pdf file, rotated 90°, and call it <b>bar.pdf</b>.
586
+
587
+ The pdf_paradise gem has a class that is tasked with rotating .pdf files.
588
+
589
+ See:
590
+
591
+ require 'pdf_paradise/utility_scripts/rotate_pdf_file.rb'
592
+ PdfParadise::RotatePdfFile.new(ARGV)
593
+
594
+ To set the rotation you can invoke the method called <b>.set_rotate()</b>.
595
+
596
+ There is also a bin/ commandline executable for this, called
597
+ <b>rotate_pdf</b>.
598
+
599
+ There is also a little GUI wrapper around that functionality available, as
600
+ part of the pdf_paradise project.
601
+
602
+ See:
603
+
604
+ PdfParadise::GUI::LibUI::RotatePdfFile.new
605
+
606
+ ## Deleting the last or the first page of a .pdf file
607
+
608
+ You can use **class DeleteLastPageOfThisPdfFile**, more
609
+ accurately called **class PdfParadise::DeleteLastPageOfThisPdfFile**,
610
+ to ***delete the last page in a .pdf file***.
611
+
612
+ In ruby code, you can invoke this like so:
613
+
614
+ require 'pdf_paradise'
615
+
616
+ PdfParadise::DeleteLastPageOfThisPdfFile.new('path_to_the_pdf_file/goes_in_here.pdf')
617
+
618
+ or shorter:
619
+
620
+ require 'pdf_paradise'
621
+
622
+ PdfParadise.delete_last_page_of_this_pdf_file('foobar.pdf')
623
+
624
+ A very similar API exists for deleting the first page of a given .pdf
625
+ file, too.
626
+
627
+ See:
628
+
629
+ In ruby code, you can invoke this like so:
630
+
631
+ require 'pdf_paradise'
632
+
633
+ PdfParadise::DeleteTheFirstPageOfThisPdfFile.new('path_to_the_pdf_file/goes_in_here.pdf')
634
+
635
+ or shorter:
636
+
637
+ require 'pdf_paradise'
638
+
639
+ PdfParadise.delete_the_first_page_of_this_pdf_file('foobar.pdf')
640
+ PdfParadise.delete_first_page_of_this_pdf_file('foobar.pdf') # Both variants work.
641
+
642
+ Note that a small libui-wrapper exists for this functionality,
643
+ under the gui/ subdirectory of this gem. It may look like
644
+ this:
645
+
646
+ <img src="https://i.imgur.com/tjN0WwS.png" style="margin: 1em">
647
+
648
+ An older ruby-gtk3 variant also exists:
649
+
650
+ <img src="https://i.imgur.com/PdMwxeP.png" style="margin: 1em">
651
+
652
+ However had, in October 2023 I found this layout confusing, and
653
+ since I was also on a journey to write as many jruby-swing
654
+ GUIs as possible, I rewrote the old ruby-gtk3 code, to then
655
+ be used as a basis for the jruby code at a later time.
656
+
657
+ The rewrite did not change much, but the new layout makes
658
+ more logical sense, I think - at the least compared to the
659
+ prior variant:
660
+
661
+ <img src="https://i.imgur.com/8obFWhb.png" style="margin: 1em">
662
+
663
+ In October 2023 the old class
664
+ DeleteFirstPageOfThisPdfFile was rewritten and
665
+ renamed, into DeleteTheFirstPageOfThisPdfFile. The code
666
+ was improved, in particular when working on windows - that was
667
+ one use case I had, that it had to work on the windows
668
+ platform as well.
669
+
670
+ ## Commandline usage
671
+
672
+ You can use the **pdf_paradise** gem from the commandline,
673
+ as other examples on this homepage shows.
674
+
675
+ For instance, say that you wish to modify **the title of a .pdf file**,
676
+ you can use a commandline invocation such as via this way:
677
+
678
+ pdf_paradise --use-this-pdf-file=location_to_your_pdf_file.pdf --set_title="The title you want to use goes in here."
679
+
680
+ You can also **shrink** a .pdf file, by using the commandline
681
+ switch <b>--shrink-pdf-size-of=foobar.pdf</b> or just
682
+ <b>--shrink</b>, such as:
683
+
684
+ pdf_paradise --shrink-pdf-size-of=foobar.pdf
685
+ pdf_paradise --shrink=foobar.pdf
686
+
687
+ The <b>shrink</b> functionality is contained in the module-method
688
+ <b>PdfParadise.reduce_size_of_this_pdf_file()</b>.
689
+
690
+ ## Converting .jpg files to .pdf files
691
+
692
+ If you have a use case to convert several .jpg files into .pdf files
693
+ then the following commandline example should be helpful:
694
+
695
+ convert /path/to/image foobar.pdf
696
+ convert *.jpg foobar.pdf
697
+
698
+ Note that this requires <b>ImageMagick</b>. <b>ImageMagick</b> is not
699
+ always perfect; it has a few problems, unfortunately.
700
+
701
+ For instance, in <b>April 2022</b> when I tried the above,
702
+ the image was repeated three times on the x-axis. I do not
703
+ know why, but that makes **absolutely no sense**. It is just
704
+ a single image, so why is the resulting .pdf file repeated
705
+ three times? Perhaps imagemagick's **convert** tool does
706
+ this automatically, but then I question the default behaviour -
707
+ **it makes no sense** for the use case I have. One image
708
+ should be one image, not three images or fifty images.
709
+
710
+ In the event that **ImageMagick** does not work very well
711
+ for your use case, consider using another software suite,
712
+ such as **img2pdf**.
713
+
714
+ The syntax for **img2pdf** goes something like this:
715
+
716
+ img2pdf *.jpg -o document.pdf
717
+ img2pdf SCAN1.jpg SCAN2.jpg SCAN3.jpg SCAN4.jpg SCAN5.jpg -o document.pdf
718
+
719
+ I liked this, so in **April 2022** this was added to
720
+ **ImageParadise**. The API for this is as follows:
721
+
722
+ ImageParadise.img2pdf('*.jpg') # If a '*' is part of the input Dir[] will be used.
723
+
724
+ As that functionality may be useful on the commandline as well, an
725
+ executable has been added at **bin/imageparadise_img2pdf**. Simply
726
+ pass the image files that you want to convert.
727
+
728
+ Usage example:
729
+
730
+ imageparadise_img2pdf *jpg
731
+
732
+ If you need the images to be ordered or sorted then you may have to
733
+ do so when specifying the image file at hand specifically, e. g. the
734
+ path to it.
735
+
736
+ So for instance:
737
+
738
+ imageparadise_img2pdf image3.jpg image1.jpg image2.png
739
+
740
+ The only drawback I have found with <b>img2pdf</b> so far is
741
+ that you can not easily add text to an image. This makes it
742
+ hard to identify which image is named how. A work around for
743
+ this is to embed the filename into the image itself, e. g.
744
+ create temporary images, and then pack them together via
745
+ <b>img2pdf</b>.
746
+
747
+ Unfortunately in September 2023 I realiased that img2pdf sometimes
748
+ creates .pdf files that are flawed. So img2pdf may not always be
749
+ an optimal choice.
750
+
751
+ ## Compressing a .pdf file (optizime the size of a .pdf file)
752
+
753
+ Sometimes you may want to reduce the filesize of a given .pdf file at hand,
754
+ such as when you need to <b>upload</b> a .pdf file, and there is some file
755
+ size limit in place, thus making it obligatory to reduce the .pdf file below
756
+ a certain threshold. This actually happened to me a few times when using
757
+ webmail-based email services, where an automatic notice was generated and
758
+ issued to me when the .pdf file was too large, such as <b>above 25MB in
759
+ size</b> or something similar.
760
+
761
+ So, let us now assume that you <b>do</b> have a use case such as described
762
+ above, or any other use case - you want to reduce the file size of a given
763
+ .pdf file at hand.
764
+
765
+ How can this be done?
766
+
767
+ Well, there are several ways of course.
768
+
769
+ One is to use online-based tools, which tend to work surprisingly well; I
770
+ verified this in February 2022. One example for this is this
771
+ website:
772
+
773
+ https://www.ilovepdf.com/compress_pdf
774
+
775
+ But, as far as the gem here is concerned, we will focus primarily on means
776
+ that can be <b>used by you, on your own</b>, without having to depend on
777
+ external websites.
778
+
779
+ Two methods will be described here - the first one requiring <b>ghostscript</b>,
780
+ the second one requiring <b>hexapdf</b>.
781
+
782
+ The important parameter in regards for <b>ghostscript</b> is the
783
+ <b>dPDFSETTINGS</b> parameter. This one will determine the compression
784
+ level, which ultimately will affect the quality of the compressed .pdf
785
+ file.
786
+
787
+ Available parameters to <b>dPDFSETTINGS</b> include <b>/screen</b>,
788
+ <b>/ebook</b>, <b>/printer</b>, <b>/prepress</b> and <b>/default</b>.
789
+
790
+ The options are as follows:
791
+
792
+ | -dPDFSETTINGS Option | Explanation |
793
+ | ------------------------- | ------------------------------------------------------------------------------- |
794
+ | -dPDFSETTINGS=/screen | Has a lower quality and smaller size. (72 dpi) |
795
+ | -dPDFSETTINGS=/ebook | Has a better quality, but has a slightly larger size (150 dpi) |
796
+ | -dPDFSETTINGS=/prepress | Output is of a higher size and quality (300 dpi) |
797
+ | -dPDFSETTINGS=/printer | Output is of a printer type quality (300 dpi) |
798
+ | -dPDFSETTINGS=/default | Selects the output which is useful for multiple purposes. Can cause large PDFS. |
799
+
800
+ In particular /screen is optimal here if you want to reduce the file size. You can
801
+ achieve, for instance, a compression from a .pdf file the size of 73 MB down to
802
+ 14 MB - which is quite neat.
803
+
804
+ class <b>PdfParadise::CompressThisPdfFile</b> can be of help here. Simply
805
+ pass, as argument to .new(), the path of the local .pdf to that class.
806
+
807
+ This class resides at:
808
+
809
+ pdf_paradise/compress/compress_this_pdf_file.rb
810
+
811
+ Note that class <b>PdfParadise::CompressThisPdfFile</b> currently only uses
812
+ ghostscript, so we have to use the above commandline options, such
813
+ as <b>-dPDFSETTINGS</b>.
814
+
815
+ You can also use a <b>toplevel method</b> if you'd like to:
816
+
817
+ require 'pdf_paradise'
818
+ PdfParadise.compress_this_pdf_file
819
+ PdfParadise.compress_this_pdf_file('/foobar.pdf') # ← Pass the path to the .pdf file into this method.
820
+
821
+ The variant using <b>hexapdf</b> is called:
822
+
823
+ PdfParadise.compress_via_pdf
824
+ PdfParadise.compress_via_pdf('foobar.pdf')
825
+
826
+ The <b>API</b> names may change at a later point in time; perhaps we will just
827
+ add a toplevel API called <b>PdfParadise.compress()</b>, but for the time being
828
+ the above APIs will be retained as they are.
829
+
830
+ In February 2024 I noticed that qpdf can also be used to compress .pdf
831
+ files.
832
+
833
+ Commandline variants in this regard may look like this:
834
+
835
+ qpdf --compress-streams=y --object-streams=generate --recompress-flate --optimize-images input_file_here.pdf output_file_there.pdf
836
+
837
+ To use the above in pdf_paradise you can use:
838
+
839
+ PdfParadise.compress_via_qpdf
840
+
841
+ ## Licence
842
+
843
+ In <b>January 2024</b>, the licence of this project was changed from GPL-2.0
844
+ towards <b>"MIT No Attribution"</b>. You can read up on this MIT licence
845
+ here:
846
+
847
+ https://spdx.org/licenses/MIT-0.html
848
+
849
+ The two most important parts are the "no warranty", as well as "use this software
850
+ how you want to", so it is a fairly liberal licence, with almost no restrictions.
851
+
852
+ I will also copy/paste the full licence here, for convenience to the reader:
853
+
854
+ Copyright 2024 Robert A. Heiler
855
+
856
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
857
+ this software and associated documentation files (the "Software"), to deal in
858
+ the Software without restriction, including without limitation the rights to
859
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
860
+ of the Software, and to permit persons to whom the Software is furnished to
861
+ do so.
862
+
863
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
864
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
865
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
866
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
867
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
868
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
869
+ IN THE SOFTWARE.
870
+
871
+ CONTACT_INFORMATION