pdf_paradise 0.1.43
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.
Potentially problematic release.
This version of pdf_paradise might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +376 -0
- data/bin/automatic_pdf_title +7 -0
- data/bin/convert_markdown_to_pdf +7 -0
- data/bin/convert_pdf_to_text +7 -0
- data/bin/merge_then_open +7 -0
- data/bin/n_pages +10 -0
- data/bin/open_main_pdf +7 -0
- data/bin/pdf_paradise +7 -0
- data/bin/set_main_book +7 -0
- data/bin/set_title_of_this_pdf_file +15 -0
- data/doc/README.gen +348 -0
- data/doc/todo/todo.md +2 -0
- data/lib/pdf_paradise.rb +5 -0
- data/lib/pdf_paradise/base/base.rb +173 -0
- data/lib/pdf_paradise/commandline/help.rb +69 -0
- data/lib/pdf_paradise/commandline/menu.rb +160 -0
- data/lib/pdf_paradise/compress_this_pdf_file.rb +82 -0
- data/lib/pdf_paradise/constants/constants.rb +59 -0
- data/lib/pdf_paradise/convert_text_to_pdf.rb +94 -0
- data/lib/pdf_paradise/css/project.css +17 -0
- data/lib/pdf_paradise/djvu_to_pdf.rb +85 -0
- data/lib/pdf_paradise/gui/README.md +6 -0
- data/lib/pdf_paradise/gui/fox/split_pdf_file.rb +77 -0
- data/lib/pdf_paradise/gui/gtk2/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +39 -0
- data/lib/pdf_paradise/gui/gtk2/pdf_viewer/pdf_viewer.rb +34 -0
- data/lib/pdf_paradise/gui/gtk2/split_pdf_file/split_pdf_file.rb +34 -0
- data/lib/pdf_paradise/gui/gtk2/statistics_widget/statistics_widget.rb +34 -0
- data/lib/pdf_paradise/gui/gtk2/to_pdf/to_pdf.rb +32 -0
- data/lib/pdf_paradise/gui/gtk3/controller/controller.rb +197 -0
- data/lib/pdf_paradise/gui/gtk3/convert_pdf_to_text/convert_pdf_to_text.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file.rb +39 -0
- data/lib/pdf_paradise/gui/gtk3/pdf_viewer/pdf_viewer.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/split_pdf_file/split_pdf_file.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb +34 -0
- data/lib/pdf_paradise/gui/gtk3/to_pdf/to_pdf.rb +32 -0
- data/lib/pdf_paradise/gui/shared_code/convert_pdf_to_text/convert_pdf_to_text_module.rb +277 -0
- data/lib/pdf_paradise/gui/shared_code/delete_the_first_or_the_last_page_of_this_pdf_file/delete_the_first_or_the_last_page_of_this_pdf_file_module.rb +428 -0
- data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer.css +5 -0
- data/lib/pdf_paradise/gui/shared_code/pdf_viewer/pdf_viewer_module.rb +284 -0
- data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file.css +0 -0
- data/lib/pdf_paradise/gui/shared_code/split_pdf_file/split_pdf_file_module.rb +294 -0
- data/lib/pdf_paradise/gui/shared_code/statistics_widget/statistics_widget_module.rb +333 -0
- data/lib/pdf_paradise/gui/shared_code/to_pdf/to_pdf_module.rb +273 -0
- data/lib/pdf_paradise/main_pdf/main_pdf.rb +437 -0
- data/lib/pdf_paradise/merge_pdf/menu.rb +63 -0
- data/lib/pdf_paradise/merge_pdf/merge_pdf.rb +292 -0
- data/lib/pdf_paradise/merge_pdf_namespace.rb +9 -0
- data/lib/pdf_paradise/merge_then_open/merge_then_open.rb +105 -0
- data/lib/pdf_paradise/pdf_file_n_total_pages.rb +227 -0
- data/lib/pdf_paradise/project/project_base_directory.rb +22 -0
- data/lib/pdf_paradise/remove_pdf_password.rb +392 -0
- data/lib/pdf_paradise/requires/batch_require_toplevel_files.rb +22 -0
- data/lib/pdf_paradise/requires/colours.rb +7 -0
- data/lib/pdf_paradise/requires/colours_and_esystem_and_save_file_and_fileutils_and_opn.rb +11 -0
- data/lib/pdf_paradise/requires/esystem_and_colours.rb +10 -0
- data/lib/pdf_paradise/requires/esystem_and_opn_and_colours.rb +8 -0
- data/lib/pdf_paradise/requires/require_the_whole_project.rb +25 -0
- data/lib/pdf_paradise/requires/require_utility_scripts.rb +7 -0
- data/lib/pdf_paradise/rotate_pdf_file.rb +144 -0
- data/lib/pdf_paradise/set_main_book.rb +156 -0
- data/lib/pdf_paradise/set_pdf_title.rb +218 -0
- data/lib/pdf_paradise/sinatra/embeddable_interface.rb +315 -0
- data/lib/pdf_paradise/toplevel_methods/automatic_pdf_title.rb +55 -0
- data/lib/pdf_paradise/toplevel_methods/convert_epub_to_pdf.rb +27 -0
- data/lib/pdf_paradise/toplevel_methods/convert_markdown_to_pdf.rb +43 -0
- data/lib/pdf_paradise/toplevel_methods/convert_ppt_to_pdf.rb +35 -0
- data/lib/pdf_paradise/toplevel_methods/e.rb +16 -0
- data/lib/pdf_paradise/toplevel_methods/esystem.rb +19 -0
- data/lib/pdf_paradise/toplevel_methods/misc.rb +52 -0
- data/lib/pdf_paradise/toplevel_methods/number_pages.rb +38 -0
- data/lib/pdf_paradise/toplevel_methods/opened_pdf_files.rb +191 -0
- data/lib/pdf_paradise/toplevel_methods/query_pdf_title.rb +182 -0
- data/lib/pdf_paradise/toplevel_methods/reduce_size_of_this_pdf_file.rb +43 -0
- data/lib/pdf_paradise/toplevel_methods/roebe.rb +17 -0
- data/lib/pdf_paradise/toplevel_methods/to_pdf.rb +38 -0
- data/lib/pdf_paradise/utility_scripts/README.md +3 -0
- data/lib/pdf_paradise/utility_scripts/convert_pdf_to_text.rb +166 -0
- data/lib/pdf_paradise/utility_scripts/delete_first_page_of_this_pdf_file.rb +185 -0
- data/lib/pdf_paradise/utility_scripts/delete_last_page_of_this_pdf_file.rb +180 -0
- data/lib/pdf_paradise/utility_scripts/delete_this_page_of_this_pdf_file.rb +310 -0
- data/lib/pdf_paradise/utility_scripts/extract_pdf_page.rb +280 -0
- data/lib/pdf_paradise/utility_scripts/pdf_optimizer.rb +113 -0
- data/lib/pdf_paradise/utility_scripts/pdf_statistics.rb +150 -0
- data/lib/pdf_paradise/utility_scripts/remove_images.rb +110 -0
- data/lib/pdf_paradise/utility_scripts/split_pdf.rb +294 -0
- data/lib/pdf_paradise/utility_scripts/to_qdf.rb +82 -0
- data/lib/pdf_paradise/version/version.rb +19 -0
- data/lib/pdf_paradise/www/README.md +2 -0
- data/lib/pdf_paradise/www/sinatra/app.rb +276 -0
- data/pdf_paradise.gemspec +64 -0
- data/test/testing_pdf_paradise.rb +9 -0
- metadata +216 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2bea15cb307c2627e40f5c58a9593f53721da2dc4b256353f92c37e004ba5cba
|
|
4
|
+
data.tar.gz: d77da143be106ff32ffa7af38f0f1aee212eb9a0619a0f10d3cc76649b88b44b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 20e61230d2f625998c0d96134f40617973e38058786f363a2ca19b71a52ea9e736a40a54b3dab79eb58f4322df81df24a48c01ac05217d576981623bf2791e4b
|
|
7
|
+
data.tar.gz: c36a6c0f805a35478703fa9644d3ee7a9edf21257c4845d8a1d18155435a5da37a175d18a09c152291880d2003e31ea7fd3191052abf7fc0a25c713829739bf5
|
data/README.md
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
[](https://www.gobolinux.org/)
|
|
2
|
+
[](https://www.ruby-lang.org/en/)
|
|
3
|
+
[](https://badge.fury.io/rb/pdf_paradise)
|
|
4
|
+
|
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">15.06.2021</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">14:24:55</span> o'clock.
|
|
6
|
+
|
|
7
|
+
This project can help with pdf-related activities, such as extracting
|
|
8
|
+
a .pdf page, converting .pdf page, merging .pdf files, splitting
|
|
9
|
+
.pdf files, setting the title of a .pdf page and similar actions.
|
|
10
|
+
|
|
11
|
+
The project has to remain quite flexible. We may use external
|
|
12
|
+
programs such as **ghoscript** or **qpdf*, or we may use pure
|
|
13
|
+
ruby solutions, such as via the gem called **combine_pdf**,
|
|
14
|
+
**prawn** or **hexapdf**.
|
|
15
|
+
|
|
16
|
+
The file here (README.gen, respectively the generated file called
|
|
17
|
+
**README.md**), will describe some of the components that make
|
|
18
|
+
up this gem.
|
|
19
|
+
|
|
20
|
+
## Rationale for making use of separate pdf-related projects
|
|
21
|
+
|
|
22
|
+
There are many pdf-related tools if you look on the www. For
|
|
23
|
+
example, we have prawn, we have qpdf, we have calibre, we
|
|
24
|
+
have hexapdf, we have ghostscript, and many more applications.
|
|
25
|
+
|
|
26
|
+
Some of these have unique features; and some of them have overlapping
|
|
27
|
+
functionality, such as reading the content of .pdf files in a
|
|
28
|
+
simplified manner (number of pages, title, author and so forth).
|
|
29
|
+
|
|
30
|
+
The PdfParadise project attempts to support as many different
|
|
31
|
+
(open-source) projects as possible. It is also permissive to
|
|
32
|
+
support closed source projects, provided that the code retains
|
|
33
|
+
simple (and simple to change). The primary focus is on
|
|
34
|
+
open-source projects though.
|
|
35
|
+
|
|
36
|
+
Why does the PdfParadise project attempt to support many different
|
|
37
|
+
pdf-related projects?
|
|
38
|
+
|
|
39
|
+
The main answer is quite simple. On Linux I have a lot of flexibility
|
|
40
|
+
and can use literally any pdf-related project just fine. On Windows,
|
|
41
|
+
however had, I am more restricted in what I can use. Not all programs
|
|
42
|
+
are available on windows or can be easily compiled there. Thus, in
|
|
43
|
+
order to allow the pdf_paradise .gem to work on windows, we need
|
|
44
|
+
this flexibility.
|
|
45
|
+
|
|
46
|
+
The reason why I added this subsection here in June 2021 was that
|
|
47
|
+
I am slowly changing the sinatra-related part of the PdfParadise
|
|
48
|
+
project, in order to embed the functionality into my main controller
|
|
49
|
+
which is handled by the **Roebe** namespace. In that controller
|
|
50
|
+
I wanted to easily offer pdf-related functionality "out of the
|
|
51
|
+
box" when I start the sinatra-application on windows. Because I
|
|
52
|
+
want to be able to offer pdf-related modifications on windows
|
|
53
|
+
as well, the PdfParadise project had to become more flexible,
|
|
54
|
+
so that a simple toplevel route, such as **/pdf**, will work
|
|
55
|
+
properly, and lead to entry points (subroutes) that allow
|
|
56
|
+
us to tap into the features offered by the PdfParadise project.
|
|
57
|
+
|
|
58
|
+
So, the summary is: the PdfParadise project must remain
|
|
59
|
+
flexible in order to support a proper workflow on windows
|
|
60
|
+
systems as well. (We could use WSL on windows, but not every
|
|
61
|
+
computer has this available, so I am targeting "vanilla"
|
|
62
|
+
windows really.)
|
|
63
|
+
|
|
64
|
+
Note that one slight drawback is that the sinatra prat of
|
|
65
|
+
the PdfParadise project now has a dependency on the
|
|
66
|
+
**cyberweb** project. This is a trade-off - for me the
|
|
67
|
+
more important part is long-term maintainability of
|
|
68
|
+
the pdf_paradise project in the long run, so a unified
|
|
69
|
+
code base had to be used in this regard.
|
|
70
|
+
|
|
71
|
+
## Converting a .pdf file to text
|
|
72
|
+
|
|
73
|
+
Sometimes you may wish to have a text-file describing the content
|
|
74
|
+
of a .pdf file, rather than the .pdf file itself.
|
|
75
|
+
|
|
76
|
+
Via class **PdfParadise::ConvertPdfToText**, residing in the file
|
|
77
|
+
at **pdf_paradise/convert_pdf_to_text.rb**, you can convert a
|
|
78
|
+
.pdf file to a text file.
|
|
79
|
+
|
|
80
|
+
Usage example from ruby, for the file called **foobar.pdf**:
|
|
81
|
+
|
|
82
|
+
PdfParadise::ConvertPdfToText.new(ARGV)
|
|
83
|
+
PdfParadise::ConvertPdfToText.new('foobar.pdf')
|
|
84
|
+
|
|
85
|
+
You can also use the bin/ file from the commandline:
|
|
86
|
+
|
|
87
|
+
convert_pdf_to_text
|
|
88
|
+
convert_pdf_to_text foobar.pdf
|
|
89
|
+
|
|
90
|
+
There is also a ruby-gtk3 widget that offers the functionality
|
|
91
|
+
from class **PdfParadise::ConvertPdfToText**, if the user
|
|
92
|
+
has gtk3 installed and the ruby-bindings to it as well.
|
|
93
|
+
|
|
94
|
+
You can start that ruby-gtk3 widget via:
|
|
95
|
+
|
|
96
|
+
convert_pdf_to_text --gui
|
|
97
|
+
|
|
98
|
+
## Commandline usage
|
|
99
|
+
|
|
100
|
+
You can use the **pdf_paradise** gem from the commandline, as
|
|
101
|
+
the example above shows.
|
|
102
|
+
|
|
103
|
+
For instance, say that you wish to modify **the title of a .pdf
|
|
104
|
+
file**, you can use a commandline invocation such as via
|
|
105
|
+
this way:
|
|
106
|
+
|
|
107
|
+
pdf_paradise --use-this-pdf-file=location_to_your_pdf_file.pdf --set_title="The title you want to use goes in here."
|
|
108
|
+
|
|
109
|
+
You can also **shrink** a .pdf file, by using the commandline
|
|
110
|
+
switch <b>--shrink-pdf-size-of=foobar.pdf</b> or just
|
|
111
|
+
<b>--shrink</b>, such as:
|
|
112
|
+
|
|
113
|
+
pdf_paradise --shrink-pdf-size-of=foobar.pdf
|
|
114
|
+
pdf_paradise --shrink=foobar.pdf
|
|
115
|
+
|
|
116
|
+
The <b>shrink</b> functionality is contained in the module-method
|
|
117
|
+
<b>PdfParadise.reduce_size_of_this_pdf_file()</b>.
|
|
118
|
+
|
|
119
|
+
## Storing the .pdf pages that are currently open
|
|
120
|
+
|
|
121
|
+
If you need to store the .pdf files that are currently open,
|
|
122
|
+
you can use the following commandline to do so:
|
|
123
|
+
|
|
124
|
+
pdfparadise --store-open-pdf-files
|
|
125
|
+
|
|
126
|
+
This will attempt to store the full path to the .pdf files
|
|
127
|
+
into a local file. That way you may also be able to batch-open
|
|
128
|
+
these .pdf files at a later time, e. g. when you switch your
|
|
129
|
+
window manager or after a reboot.
|
|
130
|
+
|
|
131
|
+
## Deleting the last or the first page of a .pdf file
|
|
132
|
+
|
|
133
|
+
You can use **class DeleteLastPageOfThisPdfFile**, more
|
|
134
|
+
accurately called **class PdfParadise::DeleteLastPageOfThisPdfFile**,
|
|
135
|
+
to ***delete the last page in a .pdf file***.
|
|
136
|
+
|
|
137
|
+
In ruby code, you can invoke this like so:
|
|
138
|
+
|
|
139
|
+
require 'pdf_paradise'
|
|
140
|
+
|
|
141
|
+
PdfParadise::DeleteLastPageOfThisPdfFile.new('path_to_the_pdf_file/goes_in_here.pdf')
|
|
142
|
+
|
|
143
|
+
or shorter:
|
|
144
|
+
|
|
145
|
+
require 'pdf_paradise'
|
|
146
|
+
|
|
147
|
+
PdfParadise.delete_last_page_of_this_pdf_file('foobar.pdf')
|
|
148
|
+
|
|
149
|
+
A very similar API exists for deleting the first page of a given .pdf
|
|
150
|
+
file, too.
|
|
151
|
+
|
|
152
|
+
See:
|
|
153
|
+
|
|
154
|
+
In ruby code, you can invoke this like so:
|
|
155
|
+
|
|
156
|
+
require 'pdf_paradise'
|
|
157
|
+
|
|
158
|
+
PdfParadise::DeleteFirstPageOfThisPdfFile.new('path_to_the_pdf_file/goes_in_here.pdf')
|
|
159
|
+
|
|
160
|
+
or shorter:
|
|
161
|
+
|
|
162
|
+
require 'pdf_paradise'
|
|
163
|
+
|
|
164
|
+
PdfParadise.delete_first_page_of_this_pdf_file('foobar.pdf')
|
|
165
|
+
|
|
166
|
+
## Converting markdown .md files to .pdf files
|
|
167
|
+
|
|
168
|
+
If you use kramdown, prawn and kramdown-pdf-converter, then you
|
|
169
|
+
can convert .md files on the commandline, via:
|
|
170
|
+
|
|
171
|
+
convert_markdown_to_pdf path_to_pdf_file_goes_here.pdf
|
|
172
|
+
|
|
173
|
+
Install the necessary gems prior to using this commandline
|
|
174
|
+
functionality.
|
|
175
|
+
|
|
176
|
+
## sinatra interface
|
|
177
|
+
|
|
178
|
+
Since as of April 2019 there is a minimal sinatra interface to the
|
|
179
|
+
PdfParadise project. Consider this incomplete <b>work-in-progress</b>.
|
|
180
|
+
|
|
181
|
+
To start it, try:
|
|
182
|
+
|
|
183
|
+
pdf_paradise --sinatra
|
|
184
|
+
|
|
185
|
+
## Querying the title of a .pdf file
|
|
186
|
+
|
|
187
|
+
<b>class PdfParadise::QueryPdfTitle</b> will report the title of
|
|
188
|
+
any .pdf file that is passed into it, on the commandline.
|
|
189
|
+
|
|
190
|
+
This currently depends on <b>exiftool</b> but at a later time,
|
|
191
|
+
this may change to also allow a query via prawn or other tools.
|
|
192
|
+
|
|
193
|
+
If you need to determine whether a given .pdf file has a title
|
|
194
|
+
or whether it does not, you can use
|
|
195
|
+
<b>PdfParadise.does_this_pdf_file_have_a_title?</b>, such
|
|
196
|
+
as in:
|
|
197
|
+
|
|
198
|
+
PdfParadise.does_this_pdf_file_have_a_title? "foobar.pdf" # => true
|
|
199
|
+
|
|
200
|
+
This method will return **true** if the .pdf file at hand has a
|
|
201
|
+
title; and **false** otherwise.
|
|
202
|
+
|
|
203
|
+
## Determining how many pages a given .pdf file has
|
|
204
|
+
|
|
205
|
+
class **PdfParadise::PdfFileNTotalPages** can be used to query
|
|
206
|
+
how many pages a given .pdf file has.
|
|
207
|
+
|
|
208
|
+
The executable called **bin/n_pages** (thus, **n_pages**) can
|
|
209
|
+
be used to query this, on the commandline.
|
|
210
|
+
|
|
211
|
+
Example:
|
|
212
|
+
|
|
213
|
+
n_pages foobar.pdf
|
|
214
|
+
|
|
215
|
+
Do note that the class requires the external program
|
|
216
|
+
called **pdfinfo**.
|
|
217
|
+
|
|
218
|
+
It is possible to query the number of pages in a given .pdf
|
|
219
|
+
file without **pdfinfo**, but some .pdf files are a bit buggy,
|
|
220
|
+
and **pdfinfo** is simply more reliable than the regex that
|
|
221
|
+
was used until March 2020. So, past March 2020, the program
|
|
222
|
+
**pdfinfo** is now used by default. Note that pdfinfo is
|
|
223
|
+
part of the poppler software suite.
|
|
224
|
+
|
|
225
|
+
You can also use the following toplevel API for this:
|
|
226
|
+
|
|
227
|
+
PdfParadise.n_pages? 'THE_PATH_TO_THE_PDF_FILE_GOES_IN_HERE.pdf'
|
|
228
|
+
PdfParadise.n_pages? 'foobar.pdf'
|
|
229
|
+
|
|
230
|
+
## Splitting a single pdf file into individual several .pdf files
|
|
231
|
+
|
|
232
|
+
You can use the following toplevel API to split up a single
|
|
233
|
+
.pdf file into several .pdf files:
|
|
234
|
+
|
|
235
|
+
PdfParadise.burst(ARGV)
|
|
236
|
+
PdfParadise.burst('foobar.pdf')
|
|
237
|
+
|
|
238
|
+
## Adding page numbers to .pdf files
|
|
239
|
+
|
|
240
|
+
Via the combine_pdf gem it is now possible to add page numbers
|
|
241
|
+
to .pdf files. This has a few limitations for complex .pdf files,
|
|
242
|
+
due to combine_pdf having limitations in turn - but for simple
|
|
243
|
+
.pdf files this should work really well.
|
|
244
|
+
|
|
245
|
+
How to use that functionality?
|
|
246
|
+
|
|
247
|
+
Consider using the following toplevel API:
|
|
248
|
+
|
|
249
|
+
PdfParadise.number_pages('this_file.pdf')
|
|
250
|
+
|
|
251
|
+
The file called **this_file.pdf** has to exist in order for
|
|
252
|
+
this to work, of course.
|
|
253
|
+
|
|
254
|
+
The current default is to display the page numbers on the bottom
|
|
255
|
+
right side. This is hardcoded, but you could modify the code
|
|
256
|
+
to adapt to your needs; see also how combine_pdf does this.
|
|
257
|
+
(You have to pass an option-hash.)
|
|
258
|
+
|
|
259
|
+
## Compressing a .pdf file (optizime the size of a .pdf file)
|
|
260
|
+
|
|
261
|
+
Sometimes you may have to reduce the filesize of a .pdf file,
|
|
262
|
+
such as when you need to upload a .pdf file, and there is
|
|
263
|
+
some file size limit otherwise.
|
|
264
|
+
|
|
265
|
+
So, let us now assume that you **do** have a use case - you
|
|
266
|
+
want to reduce the file size of a given .pdf file at hand.
|
|
267
|
+
|
|
268
|
+
How can this be done?
|
|
269
|
+
|
|
270
|
+
Well, there are several ways, but for the time being, only
|
|
271
|
+
one way will be documented here - which is the one that
|
|
272
|
+
requires **ghostscript**.
|
|
273
|
+
|
|
274
|
+
The important parameter is the **dPDFSETTINGS** one. This
|
|
275
|
+
one will determine the compression level, which ultimately
|
|
276
|
+
will affect the quality of the compressed .pdf file.
|
|
277
|
+
|
|
278
|
+
class **PdfParadise::CompressThisPdfFile** can be of
|
|
279
|
+
help here. Simply pass, as argument to .new(), the path
|
|
280
|
+
of the local .pdf to that class.
|
|
281
|
+
|
|
282
|
+
You can also use a toplevel method if you'd like to:
|
|
283
|
+
|
|
284
|
+
require 'pdf_paradise'
|
|
285
|
+
PdfParadise.compress_this_pdf_file
|
|
286
|
+
PdfParadise.compress_this_pdf_file('/foobar.pdf')
|
|
287
|
+
|
|
288
|
+
## Merging pdf files
|
|
289
|
+
|
|
290
|
+
class PdfParadise::MergePdf.new(ARGV) can be used for
|
|
291
|
+
merging .pdf files.
|
|
292
|
+
|
|
293
|
+
Currently <b>ghostscript</b> and <b>hexapdf</b> can be used for the
|
|
294
|
+
merging step.
|
|
295
|
+
|
|
296
|
+
Examples for both variants:
|
|
297
|
+
|
|
298
|
+
mergepdf one.pdf two.pdf --use-ghostscript
|
|
299
|
+
mergepdf one.pdf two.pdf --use-hexapdf
|
|
300
|
+
|
|
301
|
+
(The two -- hyphen are mandatory for commandline arguments;
|
|
302
|
+
otherwise it is assumed to be a locally existing .pdf file.)
|
|
303
|
+
|
|
304
|
+
## GUI component of the PdfParadise project
|
|
305
|
+
|
|
306
|
+
The PdfParadise project comes with some ruby-gtk3 specific
|
|
307
|
+
GUIs, but a few ruby-gtk2 and ruby-tk bindings may exist
|
|
308
|
+
as well. The gtk3 parts are the main GUI parts of this
|
|
309
|
+
project though.
|
|
310
|
+
|
|
311
|
+
You can start, from the commandline, the gtk-wrapper
|
|
312
|
+
over the **split_pdf_file** functionality.
|
|
313
|
+
|
|
314
|
+
In order to do this, do either one of the following:
|
|
315
|
+
|
|
316
|
+
pdf_paradise --gui
|
|
317
|
+
pdf_paradise --gtk
|
|
318
|
+
|
|
319
|
+
This will require the **gtk_paradise** project and the gtk
|
|
320
|
+
bindings, so quite a lot. **gem install gtk3** and
|
|
321
|
+
**gem install gtk_paradise** should help.
|
|
322
|
+
|
|
323
|
+
The GUI for class SplitPdfFile is called **PdfParadise::Gtk::SplitPdfFile**.
|
|
324
|
+
The idea behind it is to allow you to determine some of the parameters
|
|
325
|
+
in a graphical fashion.
|
|
326
|
+
|
|
327
|
+
Since as of **September 2019**, there is also a mini-widget for quickly
|
|
328
|
+
removing the first page of a .pdf file. This is really minimal right
|
|
329
|
+
now and not very elegant; it may be improved in the future, but for
|
|
330
|
+
the time being it is what it is. It is more a proof-of-concept that
|
|
331
|
+
it can work.
|
|
332
|
+
|
|
333
|
+
You can start this via:
|
|
334
|
+
|
|
335
|
+
require 'pdf_paradise/gui/gtk2/remove_first_page_of_pdf_file.rb'
|
|
336
|
+
|
|
337
|
+
PdfParadise.start_gtk_gui_remove_first_page_of_pdf_file
|
|
338
|
+
|
|
339
|
+
Note that as of **January 2021** the gtk bindings will default to
|
|
340
|
+
**ruby-gtk3**. Support for ruby-gtk2 will be retained, though,
|
|
341
|
+
but new code may not necessarily be written for ruby-gtk2 in
|
|
342
|
+
mind. ruby-gtk3 is now the main GUI target for this project.
|
|
343
|
+
|
|
344
|
+
I am slowly porting the individual widgets.
|
|
345
|
+
|
|
346
|
+
The following widgets have been ported so far:
|
|
347
|
+
|
|
348
|
+
PdfParadise::GUI::Gtk::StatisticsWidget # can be found under pdf_paradise/gui/gtk3/statistics_widget/statistics_widget.rb
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
## Contact information
|
|
353
|
+
|
|
354
|
+
If your creative mind has ideas and specific suggestions to make this
|
|
355
|
+
gem more useful in general, feel free to drop me an email at any
|
|
356
|
+
time, via:
|
|
357
|
+
|
|
358
|
+
shevy@inbox.lt
|
|
359
|
+
|
|
360
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
|
361
|
+
decided to slowly abandon gmail for various reasons. In part this is because
|
|
362
|
+
the UI annoys me (on non-chrome browser loading takes too long), but also
|
|
363
|
+
because of Google's attempt to establish mass surveillance via its
|
|
364
|
+
federated cohorts sniffing (FLoC). I do not know what happened at Google,
|
|
365
|
+
but enough is enough - there is only so much you can take while supporting
|
|
366
|
+
greed. When it comes to data mining done by private groups, ultimately
|
|
367
|
+
the user became the product.
|
|
368
|
+
|
|
369
|
+
Do keep in mind that responding to emails may take some time,
|
|
370
|
+
depending on the amount of work I may have at that moment, due
|
|
371
|
+
to reallife time constraints. I will, however had, read feedback
|
|
372
|
+
eventually. Patches and code changes are welcome too, of course,
|
|
373
|
+
as long as they are in the spirit of the project at hand, e. g.
|
|
374
|
+
fitting to the general theme. For this I may make use of github
|
|
375
|
+
as a discussion site, but this has a low priority right now.
|
|
376
|
+
|
data/bin/merge_then_open
ADDED
data/bin/n_pages
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# This file can be used to determine the number of pages in a given
|
|
6
|
+
# .pdf file.
|
|
7
|
+
# =========================================================================== #
|
|
8
|
+
require 'pdf_paradise/pdf_file_n_total_pages.rb'
|
|
9
|
+
|
|
10
|
+
PdfParadise::PdfFileNTotalPages.new(ARGV)
|
data/bin/open_main_pdf
ADDED