hexapdf 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24b0a91cc09c90d43c2be2e83f8f30701381da60d79ad993d16ffff17d243ac9
4
- data.tar.gz: 0f7cd35f0196c7a11e37b5cb784e867fdfd75676ee490866f840847d35a2256b
3
+ metadata.gz: af21f47a848886d8b8ca7f151d7fe7b836af0f23b292e181040bc12706c05f0a
4
+ data.tar.gz: b608c3d0846516a57fc1186f25b4c2cfb785570cfab87c304326440a9498cda5
5
5
  SHA512:
6
- metadata.gz: 729d5b3c23ed9c9ca1d1bb604cf0ad7838d90024295983725d314a108eee31519d361255d4c1166b4321d19cd5cf941b57d5aca1819c16aeccf8ef4a6baa6a81
7
- data.tar.gz: 8a5355ced86a1326e3bf46eb5084f856c1df00acafc1058ecd56d0eaa4615ee69f73c695602e893d523599b799d9b46ca4d39265a4f84954dedb48b3eb5614ff
6
+ metadata.gz: 9c5791ad89c158c6b16fdaa3f9661bcd561ebeab729bb8963c20db35238de7dfb53fa27accdfa357553c3ebe5c34f0151d784bc849562d49d89035a249f9203e
7
+ data.tar.gz: 54c0e38d0e66a15e21870c50421e327d2ec4f1a6c13720436d6ad6fa27ee8d6c1fc6d09274f36c4ebd3813a6d508759a69034ccc986cd8c6d2c9eb0bdb97d7d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.11.2 - 2019-11-22
2
+
3
+ ### Fixed
4
+
5
+ * Conversion of [HexaPDF::Rectangle] type when the original is not a plain
6
+ Array but a [HexaPDF::PDFArray]
7
+
8
+
1
9
  ## 0.11.1 - 2019-11-19
2
10
 
3
11
  ### Fixed
data/CONTRIBUTERS CHANGED
@@ -1,5 +1,5 @@
1
1
  Count Name
2
2
  ======= ====
3
- 1091 Thomas Leitner <t_leitner@gmx.at>
3
+ 1093 Thomas Leitner <t_leitner@gmx.at>
4
4
  1 Stanislav (Stas) Katkov <sk@skylup.com>
5
5
  1 Daniel Kraus <bovender@bovender.de>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.11.2
@@ -351,7 +351,7 @@ module HexaPDF
351
351
 
352
352
  # Wraps a given array in the Rectangle class. Otherwise returns +nil+.
353
353
  def self.convert(data, _type, document)
354
- return unless data.kind_of?(Array)
354
+ return unless data.kind_of?(Array) || data.kind_of?(HexaPDF::PDFArray)
355
355
  document.wrap(data, type: Rectangle)
356
356
  end
357
357
 
@@ -37,6 +37,6 @@
37
37
  module HexaPDF
38
38
 
39
39
  # The version of HexaPDF.
40
- VERSION = '0.11.1'
40
+ VERSION = '0.11.2'
41
41
 
42
42
  end
data/man/man1/hexapdf.1 CHANGED
@@ -1,596 +0,0 @@
1
- .\" generated by kramdown
2
- .TH "HEXAPDF" "1" "November 2016"
3
- .SH NAME
4
- hexapdf \- A Versatile PDF Manipulation Application
5
- .SH "SYNOPSIS"
6
- \fBhexapdf\fP [\fBOPTIONS\fP] \fBcommand\fP [\fBCOMMAND OPTIONS\fP]\.\.\.
7
- .SH "DESCRIPTION"
8
- hexapdf is an application for PDF manipulation\. It is part of the
9
- .UR http://hexapdf\.gettalong\.org
10
- hexapdf
11
- .UE
12
- library which also allows PDF creation, among other things\.
13
- .P
14
- Using the hexapdf application the following tasks can be performed with PDF files:
15
- .sp
16
- .PD 0
17
- .IP \(bu 4
18
- Modifying an existing PDF file (see the \fBmodify\fP command)
19
- .IP \(bu 4
20
- Merging multiple PDF files into one (see the \fBmerge\fP command)
21
- .IP \(bu 4
22
- Splitting a PDF file into individual pages (see the \fBsplit\fP command)
23
- .IP \(bu 4
24
- Optimizing the file size of a PDF file (see the \fBoptimize\fP command)
25
- .IP \(bu 4
26
- Watermarking/Stamping a PDF onto another one (see the \fBwatermark\fP command)
27
- .IP \(bu 4
28
- Extracting embedded files (see the \fBfiles\fP command)
29
- .IP \(bu 4
30
- Extracting images (see the \fBimages\fP command)
31
- .IP \(bu 4
32
- Converting images to PDF (see the \fBimage2pdf\fP command)
33
- .IP \(bu 4
34
- Showing general information of a PDF file (see the \fBinfo\fP command)
35
- .IP \(bu 4
36
- Batch execution of a command on multiple PDF files (see the \fBbatch\fP command)
37
- .IP \(bu 4
38
- Inspecting the internal structure of a PDF file (see the \fBinspect\fP command)
39
- .PD
40
- .P
41
- The application contains a built\-in \fBhelp\fP command that can be used to provide a quick reminder of a command\[u2019]s purpose and its options\.
42
- .SH "OPTIONS"
43
- The following options can only be used when no command is specified:
44
- .TP
45
- \fB\-v\fP, \fB\-\-version\fP
46
- Show the version of the hexapdf application and exit\.
47
- .P
48
- These options are available on every command (except if they are overridden):
49
- .TP
50
- \fB\-\-[no\-]force\fP
51
- Force overwriting existing files\. Default: \fIfalse\fP\&\.
52
- .TP
53
- \fB\-\-strict\fP
54
- Enable strict parsing and validation\. By default, correctable parse error and validation problems are treated as warnings which allows processing most PDF files\. If this option is used, correctable parse errors and uncorrectable validation problems are treated as errors\.
55
- .RS
56
- .P
57
- Note that a PDF file may have validation errors and still be usable since most viewing applications are very forgiving\.
58
- .RE
59
- .TP
60
- \fB\-\-verbose\fP, \fB\-v\fP
61
- Enable more verbose output\. There are three verbosity levels: 0 (no output), 1 (warning output) and 2 (warning and informational output)\. The default level is 1, specifying this option increases it to 2\.
62
- .TP
63
- \fB\-\-quiet\fP
64
- Suppress any output by setting the verbosity level to 0\. Also see the description of \fB\-\-verbose\fP above\.
65
- .TP
66
- \fB\-h\fP, \fB\-\-help\fP
67
- Show the help for the application if no command was specified, or the command help otherwise\.
68
- .SS "Optimization Options"
69
- Theses options can only be used with the \fBmerge\fP, \fBmodify\fP and \fBoptimize\fP commands and control optimization aspects when writing an output PDF file\. Note that the defaults maybe different depending on the command\.
70
- .TP
71
- \fB\-\-[no\-]compact\fP
72
- Delete unnecessary PDF objects\. This includes merging the base revision and all incremental updates into a single revision\. Default: \fIyes\fP\&\.
73
- .TP
74
- \fB\-\-object\-streams\fP \fIMODE\fP
75
- Defines how object streams should be treated: \fIgenerate\fP will remove all exisiting object streams and generate new ones, \fIdelete\fP will only remove existing object streams and \fIpreserve\fP will do nothing\. Default: \fIpreserve\fP\&\.
76
- .TP
77
- \fB\-\-xref\-streams\fP \fIMODE\fP
78
- Defines how cross\-reference streams should be treated: \fIgenerate\fP will add them, \fIdelete\fP will remove them and \fIpreserve\fP will do nothing\. Default: \fIpreserve\fP\&\.
79
- .TP
80
- \fB\-\-streams\fP \fIMODE\fP
81
- Defines how streams should be treated: \fIcompress\fP will compress them when possible, \fIuncompress\fP will uncompress them when possible and \fIpreserve\fP will do nothing to them\. Default: \fIpreserve\fP\&\.
82
- .TP
83
- \fB\-\-[no\-]compress\-pages\fP
84
- Recompress page content streams\. This is a very expensive operation in terms of processing time and won\[u2019]t lead to great file size improvements in many cases\. Default: \fIno\fP\&\.
85
- .TP
86
- \fB\-\-[no\-]optimize\-fonts\fP
87
- Optimize embedded font files by removing normally unneeded font data\. Note that this may have a negative effect on PDFs with forms since form entry usually requires fully embedded font files\. Default: \fIno\fP\&\.
88
- .SS "Encryption Options"
89
- These options can only be used with the \fBmerge\fP and \fBmodify\fP commands and control if and how an output PDF file should be encrypted\. All options except \fB\-\-decrypt\fP automatically enable \fB\-\-encrypt\fP\&\.
90
- .P
91
- Note that if a password is needed to open the input file and if encryption parameters are changed, the provided password is not automatically used for the output file!
92
- .TP
93
- \fB\-\-decrypt\fP
94
- Remove any encryption\.
95
- .RS
96
- .P
97
- If neither \fB\-\-decrypt\fP nor \fB\-\-encrypt\fP are specified, the existing encryption configuration is preserved\.
98
- .RE
99
- .TP
100
- \fB\-\-encrypt\fP
101
- Encrypt the \fIOUTPUT\fP\&\.
102
- .RS
103
- .P
104
- If neither \fB\-\-decrypt\fP nor \fB\-\-encrypt\fP are specified, the existing encryption configuration is preserved\.
105
- .RE
106
- .TP
107
- \fB\-\-owner\-password\fP \fIPASSWORD\fP
108
- The owner password to be set on the output file\. This password is needed when operations not allowed by the permissions need to be done\. It can also be used when opening the PDF file\.
109
- .RS
110
- .P
111
- If an owner password is set but no user password, the output file can be opened without a password but the operations are restricted as if a user password were set\.
112
- .P
113
- Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
114
- .RE
115
- .TP
116
- \fB\-\-user\-password\fP \fIPASSWORD\fP
117
- The user password to be set on the output file\. This password is needed when opening the PDF file\. The application should restrict the operations to those allowed by the permissions\.
118
- .RS
119
- .P
120
- Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
121
- .RE
122
- .TP
123
- \fB\-\-algorithm\fP \fIALGORITHM\fP
124
- The encryption algorithm to use on the output file\. Allowed algorithms are \fIaes\fP and \fIarc4\fP but \fIarc4\fP should only be used if it is absolutely necessary for compatibility reasons\. Default: \fIaes\fP\&\.
125
- .TP
126
- \fB\-\-key\-length\fP \fIBITS\fP
127
- The length of the encryption key in bits\. The allowed values differ based on the chosen algorithm: A number divisible by eight between 40 to 128 for \fIarc4\fP and 128 or 256 for \fIaes\fP\&\. Default: \fB128\fP\&\.
128
- .RS
129
- .P
130
- Note: Using 256bit AES encryption can lead to problems viewing the PDF in many applications on various platforms!
131
- .RE
132
- .TP
133
- \fB\-\-force\-V4\fP
134
- Force the use of PDF encryption version 4 if key length is \fI128\fP and algorithm is \fIarc4\fP\&\. This option is probably only useful for testing the implementation of PDF libraries\[u2019] encryption handling\.
135
- .TP
136
- \fB\-\-permissions\fP \fIPERMS\fP
137
- A comma separated list of permissions to be set on the output file:
138
- .RS
139
- .TP
140
- \fIprint\fP
141
- allow printing
142
- .TP
143
- \fImodify_content\fP
144
- allow modification of the content of pages
145
- .TP
146
- \fIcopy_content\fP
147
- allow text extraction and similar operations
148
- .TP
149
- \fImodify_annotation\fP
150
- allow creation and modification of annotations and filling in of forms
151
- .TP
152
- \fIfill_in_forms\fP
153
- allow filling in of forms even if \fImodify_annotation\fP is not set
154
- .TP
155
- \fIextract_content\fP
156
- allow text and graphics extraction in accessibility cases
157
- .TP
158
- \fIassemble_document\fP
159
- allow page modifications and bookmark creation
160
- .TP
161
- \fIhigh_quality_print\fP
162
- allow high quality printing
163
- .RE
164
- .SH "COMMANDS"
165
- hexapdf uses a command\-style interface\. This means that it provides different functionalities depending on the used command, and each command can have its own options\.
166
- .P
167
- There is no need to write the full command name for hexapdf to understand it, the only requirement is that is must be unambiguous\. So using \fBf\fP for the \fBfiles\fP command is sufficient\. The same is true for long option names and option values\.
168
- .P
169
- Any command that reads and writes a PDF file may do in\-place processing of the file\. This is automatically done if an input file name is the same as the output file name\. Note that the option \fB\-\-force\fP has to be used in this case\.
170
- .SS "batch"
171
- Synopsis: \fBbatch\fP \fICOMMAND\fP \fIFILES\.\.\.\fP
172
- .P
173
- This command allows executing a single command for multiple input files, thereby reducing the overall execution time\.
174
- .P
175
- The first argument \fICOMMAND\fP is used as a hexapdf command line and must not contain the binary name, just everything else\. The rest of the arguments are the input files\. The specified command will be executed for each input file, with all occurences of {} being replaced by the file name\.
176
- .SS "files"
177
- Synopsis: \fBfiles\fP [\fBOPTIONS\fP] \fIPDF\fP
178
- .P
179
- This command extracts embedded files from the \fIPDF\fP\&\. If the \fB\-\-extract\fP option is not specified, the indices and names of the embedded files are just listed\.
180
- .TP
181
- \fB\-e\fP [\fIA,B,C,\.\.\.\fP], \fB\-\-extract\fP [\fIA,B,C,\.\.\.\fP]
182
- The indices of the embedded files that should be extracted\. The value \fI0\fP can be used to extract all embedded files\.
183
- .TP
184
- \fB\-s\fP, \fB\-\-[no\-]search\fP
185
- Search the whole PDF file instead of the standard locations, that is files attached to the document as a whole or to an individual page\. Defaults to \fIfalse\fP\&\.
186
- .TP
187
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
188
- The password to decrypt the \fIPDF\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
189
- .SS "help"
190
- Synopsis: \fBhelp\fP [\fICOMMAND\fP\.\.\.]
191
- .P
192
- This command prints the application help if no arguments are given\. If one or more command names are given as arguments, these arguments are interpreted as a list of commands with sub\-commands and the help for the innermost command is shown\.
193
- .SS "images"
194
- Synopsis: \fBimages\fP [\fBOPTIONS\fP] \fIPDF\fP
195
- .P
196
- This command extracts images from the \fIPDF\fP\&\. If the \fB\-\-extract\fP option is not specified, the images are listed with their indices and additional information, sorted by page number\. Note that if an image is used multiple times on a page, only the first occurence of it will be included\.
197
- .P
198
- The \fB\-\-extract\fP option can then be used to extract one or more images, saving them to files called \fBPREFIX\-N\.EXT\fP where the prefix can be set via \fB\-\-prefix\fP, \fIN\fP is the image index and \fIEXT\fP is either png, jpg or jpx\.
199
- .TP
200
- \fB\-e\fP [\fIA,B,C,\.\.\.\fP], \fB\-\-extract\fP [\fIA,B,C,\.\.\.\fP]
201
- The indices of the images that should be extracted\. Use \fI0\fP or no value to extract all images\.
202
- .TP
203
- \fB\-\-prefix\fP \fIPREFIX\fP
204
- The prefix to use when saving images\. May include directories\. Defaults to \fIimage\fP\&\.
205
- .TP
206
- \fB\-s\fP, \fB\-\-[no\-]search\fP
207
- Search the whole PDF file instead of the standard locations, that is, images referenced by pages\. Defaults to \fIfalse\fP\&\.
208
- .TP
209
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
210
- The password to decrypt the \fIPDF\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
211
- .P
212
- The following information is shown for each image when listing images:
213
- .RS
214
- .TP
215
- \fBindex\fP
216
- The image index needed when this image should be extracted\.
217
- .TP
218
- \fBpage\fP
219
- The page number on which this image appears\.
220
- .TP
221
- \fBoid\fP
222
- The PDF internal object identifier consisting of the object and generation numbers\.
223
- .TP
224
- \fBwidth\fP
225
- The width of the image in pixels\.
226
- .TP
227
- \fBheight\fP
228
- The height of the image in pixels\.
229
- .TP
230
- \fBcolor\fP
231
- The color space used for the image\. Either gray, rgb, cmyk or other\.
232
- .TP
233
- \fBcomp\fP
234
- The number of color components\.
235
- .TP
236
- \fBbpc\fP
237
- The number of bits per color component\.
238
- .TP
239
- \fBx\-ppi\fP
240
- The pixels per inch (PPI) of the x\-direction of the image, as found on the page\.
241
- .TP
242
- \fBy\-ppi\fP
243
- The pixels per inch (PPI) of the y\-direction of the image, as found on the page\.
244
- .TP
245
- \fBsize\fP
246
- The file size of the image as stored in the PDF\.
247
- .TP
248
- \fBtype\fP
249
- The image type\. Either jpg (JPEG), jp2 (JPEG2000), ccitt (CCITT Group 3 or 4 Fax), jbig2 (JBIG2) or png (PNG)\.
250
- .TP
251
- \fBwritable\fP
252
- Either true or false depending on whether hexapdf supports the image format\.
253
- .RE
254
- .SS "image2pdf"
255
- Synopsis: \fBiamge2pdf\fP [\fBOPTIONS\fP] \fIOUTPUT\fP [\fIIMAGES\fP\.\.\.]
256
- .P
257
- This command converts one or more images into a single PDF file, one image per page\. The various options allow setting a page size, scaling the images and defining margins\. Images are always centered on the pages\.
258
- .P
259
- Supported image formats are JPEG, PNG and PDF\. Images in PNG format may take longer to process due to the way they are stored inside a PDF\.
260
- .TP
261
- \fB\-p\fP \fIPAGE_SIZE\fP, \fB\-\-page\-size\fP \fIPAGE_SIZE\fP
262
- The PDF page size\. The default value of \fIauto\fP chooses the page size based on the image dimensions\. Either \fIauto\fP which chooses a size based on the image size or a valid page size like \fIA4\fP, \fIA4\-landscape\fP or \fI595x842\fP\&\. The \fI\-landscape\fP suffix can be added to any predefined page size\.
263
- .RS
264
- .P
265
- Common page sizes are \fIA4\fP, \fIA5\fP, \fIA3\fP, \fILetter\fP and \fILegal\fP\&\.
266
- .RE
267
- .TP
268
- \fB\-\-[no\-]auto\-rotate\fP
269
- If enabled (the default) pages are automatically rotated so that the pages and images always have the same orientation\. I\.e\. landscape\-oriented images go on landscape page, portrait\-oriented images on portrait pages\.
270
- .RS
271
- .P
272
- Note that pages won\[u2019]t be rotated if scaling is used and the image would fit into the requested page size\.
273
- .RE
274
- .TP
275
- \fB\-s\fP \fISCALE\fP, \fB\-\-scale\fP \fISCALE\fP
276
- Defines how the images should be scaled\. The default value of \fIfit\fP scales the images so that they optimally fit the pages\. Otherwise \fISCALE\fP is interpreted as the minimum number of pixels per inch (PPI) that the images should have\.
277
- .TP
278
- \fB\-m\fP \fIMARGINS\fP, \fB\-\-margins\fP \fIMARGINS\fP
279
- Defines the margins around the images\. The argument \fIMARGINS\fP can either be a single number specifying the margin on all four sides, or four numbers separated by commas (like \fB10,20,30,40\fP) specifying the top, right, bottom and left margins\. Default: \fI0\fP\&\.
280
- .P
281
- Additionally, the \fBOptimization Options\fP and \fBEncryption Options\fP can be used\.
282
- .SS "info"
283
- Synopsis: \fBinfo\fP [\fBOPTIONS\fP] \fIFILE\fP
284
- .P
285
- This command reads the \fIFILE\fP and shows general information about it, like author information, PDF version used, encryption information and so on\.
286
- .TP
287
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
288
- The password to decrypt the PDF \fIFILE\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
289
- .SS "inspect"
290
- Synopsis: \fBinspect\fP [\fBOPTIONS\fP] \fIFILE\fP \fI[[CMD [ARGS]]\.\.\.]\fP
291
- .P
292
- This command is useful when one needs to inspect the internal object structure or a stream of a PDF file\.
293
- .P
294
- If no arguments are given, the interactive mode is started\. This interactive mode allows you to execute inspection commands without re\-parsing the PDF file, leading to better performance for big PDF files\.
295
- .P
296
- Otherwise the arguments are interpreted as interactive mode commands and executed\. It is possible to specify more than one command in this way by separating them with semicolons, or whitespace in case the number of command arguments is fixed\.
297
- .TP
298
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
299
- The password to decrypt the PDF \fIFILE\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
300
- .P
301
- If an interactive mode command or argument is \fBOID[,GEN]\fP, object and generation numbers are expected\. The generation number defaults to 0 if not given\. PDF objects are always shown in the native PDF syntax\.
302
- .P
303
- The available commands are:
304
- .TP
305
- \fBOID[,GEN] | o[bject] OID[,GEN]\fP
306
- Print the given indirect object\.
307
- .TP
308
- \fBr[ecursive] OID[,GEN]\fP
309
- Print the given indirect object recursively\. This means that all references found in the object are resolved and the resulting objects themselves recursively printed\.
310
- .RS
311
- .P
312
- To make it easier to compare such structures between PDF files, the entries of dictionaries are printed in sorted order and the original references are replaced by custom ones\. Once an indirect object is first encountered, it is preceeded by either \fB{obj INDEX}\fP or \fB{obj page PAGEINDEX}\fP where \fBINDEX\fP is an increasing number and \fBPAGEINDEX\fP is the index of the page\. Later references are replaced by \fB{ref INDEX}\fP and \fB{ref page PAGEINDEX}\fP respectively\.
313
- .P
314
- Here is a simplified example output:
315
- .sp
316
- .RS 4
317
- .EX
318
- <<
319
- /Info {obj 1} <<
320
- /Producer (HexaPDF version 0\.9\.3)
321
- >>
322
- /Root {obj 2} <<
323
- /Pages {obj 3} <<
324
- /Count 1
325
- /Kids [{obj page 1} <<
326
- /MediaBox [0 0 595 842 ]
327
- /Parent {ref 3}
328
- /Type /Page
329
- >> ]
330
- /Type /Pages
331
- >>
332
- /Type /Catalog
333
- >>
334
- /Size 4
335
- >>
336
- .EE
337
- .RE
338
- .P
339
- On line 2 the indirect object for the key \fB/Info\fP is shown, preceeded by the custom reference\. On line 8 is an example for a page object with the special reference key\. And on line 10 there is a back reference to the object with index 3 which is started on line 6\.
340
- .RE
341
- .TP
342
- \fBs[tream] OID[,GEN]\fP
343
- Print the filtered stream, i\.e\. the stream with all filters applied\. This is useful, for example, to view the contents of content streams\.
344
- .TP
345
- \fBraw[\-stream] OID[,GEN]\fP
346
- Print the raw stream, i\.e\. the stream as it appears in the file\. This is useful, for example, to extract streams into files\.
347
- .TP
348
- \fBx[ref] OID[,GEN]\fP
349
- Print the cross\-reference entry for the given indirect object\.
350
- .TP
351
- \fBc[atalog]\fP
352
- Print the catalog dictionary\.
353
- .TP
354
- \fBt[railer]\fP
355
- Print the trailer dictionary\.
356
- .TP
357
- \fBp[ages] [RANGE]\fP
358
- Print the pages with their object and generation numbers and their associated content streams\. If a range is specified, only those pages are listed\. See the \fBPAGES SPECIFICATION\fP below for details on the allowed format of \fIPAGES\fP\&\.
359
- .TP
360
- \fBpc | page\-count\fP
361
- Print the number of pages\.
362
- .TP
363
- \fBsearch REGEXP\fP
364
- Print all objects matching the pattern\. Each object is preceeded by \fBobj OID GEN\fP and followed by \fBendobj\fP to make it easier to further explore the data\.
365
- .TP
366
- \fBh[elp]\fP
367
- Print the available commands with a short description\.
368
- .TP
369
- \fBq[uit]Quit\fP
370
- Quit the interactive mode\.
371
- .SS "merge"
372
- Synopsis: \fBmerge\fP [\fBOPTIONS\fP] { \fIINPUT\fP | \fB\-\-empty\fP } [\fIINPUT\fP]\.\.\. \fIOUTPUT\fP
373
- .P
374
- This command merges pages from multiple PDFs into one output file which can optionally be encrypted/decrypted and optimized in various ways\.
375
- .P
376
- The first input file is the primary file from which meta data like file information, outlines, etc\. are taken from\. Alternatively, it is possible to start with an empty PDF file by using \fB\-\-empty\fP\&\. The order of the input files is important as the pages are added in that order\. Note that the \fB\-\-password\fP and \fB\-\-pages\fP options always apply to the last preceeding input file\.
377
- .P
378
- An input file can be specified multiple times, using a different \fB\-\-pages\fP option each time\. The \fB\-\-password\fP option, if needed, only needs to be used the first time\.
379
- .TP
380
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
381
- The password to decrypt the last input file\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
382
- .TP
383
- \fB\-i\fP \fIPAGES\fP, \fB\-\-pages\fP \fIPAGES\fP
384
- The pages (optionally rotated) from the last input file that should be included in the \fIOUTPUT\fP\&\. See the \fBPAGES SPECIFICATION\fP below for details on the allowed format of \fIPAGES\fP\&\. Default: \fI1\-e\fP (i\.e\. all pages with no additional rotation applied)\.
385
- .TP
386
- \fB\-e\fP, \fB\-\-empty\fP
387
- Use an empty file as primary file\. This will lead to an output file that just contains the included pages of the input file and no other data from the input files\.
388
- .TP
389
- \fB\-\-interleave\fP
390
- Interleave the pages from the input files: Takes the first specified page from the first input file, then the first specified page from the second input file, and so on\. After that the same with the second, third, \.\.\. specified pages\. If fewer pages were specified for an input file, the input file is just skipped for the rest of the rounds\.
391
- .P
392
- Additionally, the \fBOptimization Options\fP and \fBEncryption Options\fP can be used\.
393
- .SS "modify"
394
- Synopsis: \fBmodify\fP [\fBOPTIONS\fP] \fIINPUT\fP \fIOUTPUT\fP
395
- .P
396
- This command modifies a PDF file\. It can be used to select pages that should appear in the output file and/or rotate them\. The output file can also be encrypted/decrypted and optimized in various ways\.
397
- .TP
398
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
399
- The password to decrypt the \fIINPUT\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
400
- .TP
401
- \fB\-i\fP \fIPAGES\fP, \fB\-\-pages\fP \fIPAGES\fP
402
- The pages (optionally rotated) from the \fIINPUT\fP that should be included in the \fIOUTPUT\fP\&\. See the \fBPAGES SPECIFICATION\fP below for details on the allowed format of \fIPAGES\fP\&\. Default: \fI1\-e\fP (i\.e\. all pages with no additional rotation applied)\.
403
- .TP
404
- \fB\-e\fP \fIFILE\fP, \fB\-\-embed\fP \fIFILE\fP
405
- Embed the given file into the \fIOUTPUT\fP using built\-in features of PDF\. This option can be used multiple times to embed more than one file\.
406
- .P
407
- Additionally, the \fBOptimization Options\fP and \fBEncryption Options\fP can be used\.
408
- .SS "optimize"
409
- Synopsis: \fBoptimize\fP [\fBOPTIONS\fP] \fIINPUT\fP \fIOUTPUT\fP
410
- .P
411
- This command uses several optimization strategies to reduce the file size of the PDF file\.
412
- .P
413
- By default, all strategies except page compression are used since page compression may take a very long time without much benefit\.
414
- .TP
415
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
416
- The password to decrypt the \fIINPUT\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
417
- .P
418
- The \fBOptimization Options\fP can be used with this command\. Note that the defaults are changed to provide good compression out of the box\.
419
- .SS "split"
420
- Synopsis: \fBsplit\fP [\fBOPTIONS\fP] \fIINPUT\fP [\fIOUTPUT_SPEC\fP]
421
- .P
422
- This command splits the input file into multiple output files, each containing one page\.
423
- .P
424
- If no \fIOUTPUT_SPEC\fP is given, files of the form \fIINPUT_0001\.pdf\fP, \fIINPUT_0002\.pdf\fP, \.\.\. and so on are created (only the name \fIINPUT\fP without the file extension is used)\. Otherwise \fIOUTPUT_SPEC\fP determines the file names of the created files, with a printf\-style format string like \[u2018]%04d\[u2019] being replaced by the page number\. For example, if the files should be named \fIpage_01\.pdf\fP, \fIpage_02\.pdf\fP and so on, use \fIpage_%02d\.pdf\fP for the \fIOUTPUT_SPEC\fP\&\.
425
- .TP
426
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
427
- The password to decrypt the \fIINPUT\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
428
- .P
429
- Additionally, the \fBOptimization Options\fP and \fBEncryption Options\fP can be used\.
430
- .SS "watermark"
431
- Synopsis: \fBwatermark\fP [\fBOPTIONS\fP] \fIINPUT\fP \fIOUTPUT\fP
432
- .P
433
- This command uses one ore more pages from a PDF file and applies them as background or stamp (depending on the \fB\-\-type\fP option) on another PDF file\. If multiple pages are selected from the watermark PDF, the \fB\-\-repeat\fP option can be used to specify how they should be applied\.
434
- .TP
435
- \fB\-w\fP \fIWATERMARK\fP, \fB\-\-watermark\-file\fP \fIWATERMARK\fP
436
- The PDF file that should be used for watermarking\.
437
- .TP
438
- \fB\-i\fP \fIPAGES\fP, \fB\-\-pages\fP \fIPAGES\fP
439
- The pages from the \fIWATERMARK\fP PDF that should be used\. The first \fIWATERMARK\fP page is applied to the first \fIINPUT\fP page, the second \fIWATERMARK\fP page to the second \fIINPUT\fP page and so on\. If there are fewer \fIWATERMARK\fP pages than \fIINPUT\fP pages, the \fB\-\-repeat\fP option comes into play\.
440
- .RS
441
- .P
442
- See the \fBPAGES SPECIFICATION\fP below for details on the allowed format of \fIPAGES\fP\&\. Default: \fI1\fP\&\.
443
- .RE
444
- .TP
445
- \fB\-r\fP \fIREPEAT_MODE\fP, \fB\-\-repeat\fP \fIREPEAT_MODE\fP
446
- Specifies how the \fIWATERMARK\fP pages should be repeated: \fBlast\fP (the default) will only repeat the last \fIWATERMARK\fP page whereas \fBall\fP will cyclically repeat all \fIWATERMARK\fP pages\.
447
- .TP
448
- \fB\-t\fP \fIWATERMARK_TYPE\fP, \fB\-\-type\fP \fIWATERMARK_TYPE\fP
449
- Specifies how the \fIWATERMARK\fP pages are applied to the \fIINPUT\fP pages: \fBbackground\fP (the default) applies them below the page contents and \fBstamp\fP applies them above the page contents\.
450
- .TP
451
- \fB\-p\fP \fIPASSWORD\fP, \fB\-\-password\fP \fIPASSWORD\fP
452
- The password to decrypt the \fIINPUT\fP\&\. Use \fB\-\fP for \fIPASSWORD\fP for reading it from standard input\.
453
- .P
454
- Additionally, the \fBOptimization Options\fP and \fBEncryption Options\fP can be used\.
455
- .SS "version"
456
- This command shows the version of the hexapdf application\. It is an alternative to using the global \fB\-\-version\fP option\.
457
- .SH "PAGES SPECIFICATION"
458
- Some commands allow the specification of pages using a \fIPAGES\fP argument\. This argument is expected to be a comma separated list of single page numbers or page ranges of the form \fISTART\fP\-\fIEND\fP\&\. The character \[u2018]\fBe\fP\[u2019] represents the last page and can be used instead of a single number or in a range\. The pages are used in the order in which the are specified\.
459
- .P
460
- If the start number of a page range is higher than the end number, the pages are used in the reverse order\.
461
- .P
462
- Single page numbers that are not valid are ignored\. If a page number in a page range is higher than the page number of the last page, the page number of the last page is used instead\.
463
- .P
464
- Step values can be used with page ranges\. If a range is followed by \fI/STEP\fP, \fISTEP\fP \- 1 pages are skipped after each used page\.
465
- .P
466
- Additionally, the page numbers and ranges can be suffixed with a rotation modifier:
467
- .sp
468
- .PD 0
469
- .TP
470
- \fBl\fP
471
- Rotate the page left, that is 90 degrees counterclockwise
472
- .TP
473
- \fBr\fP
474
- Rotate the page right, that is 90 degrees clockwise
475
- .TP
476
- \fBd\fP
477
- Rotate the page 180 degrees
478
- .TP
479
- \fBn\fP
480
- Remove any set page rotation
481
- .PD
482
- .P
483
- Note that this additional functionality may not be used by all commands (it is used, for example, by the \fBmodify\fP command)\.
484
- .P
485
- Examples:
486
- .IP \(bu 4
487
- \fB1,2,3\fP: The pages 1, 2 and 3\.
488
- .IP \(bu 4
489
- \fB11,4\-9,1,e\fP: The pages 11, 4 to 9, 1 and the last page, in exactly this order\.
490
- .IP \(bu 4
491
- \fB1\-e\fP: All pages of the document\.
492
- .IP \(bu 4
493
- \fBe\-1\fP: All pages of the document in reverse order\.
494
- .IP \(bu 4
495
- \fB1\-5/2\fP: The pages 1, 3 and 5\.
496
- .IP \(bu 4
497
- \fB10\-1/3\fP: The pages 10, 7, 4 and 1\.
498
- .IP \(bu 4
499
- \fB1l,2r,3\-5d,6n\fP: The pages 1 (rotated left), 2 (rotated right), 3 to 5 (all rotated 180 degrees) and 6 (any possibly set rotation removed)\.
500
- .SH "EXAMPLES"
501
- .SS "merge"
502
- \fBhexapdf merge input1\.pdf input2\.pdf input3\.pdf output\.pdf\fP
503
- .br
504
- \fBhexapdf merge \-e input1\.pdf input2\.pdf input3\.pdf output\.pdf\fP
505
- .P
506
- Merging: In the first case use \fBinput1\.pdf\fP as primary input file and merge the pages from \fBinput2\.pdf\fP and \fBinput3\.pdf\fP into it\. In the second case an empty PDF file is used for merging the pages from the three given input files into it; the resulting output file will not have an meta data or other additional data from the first input file\.
507
- .P
508
- \fBhexapdf merge odd\.pdf even\.pdf \-\-interleave combined\.pdf\fP
509
- .P
510
- Page interleaving: Takes alternately a page from \fBodd\.pdf\fP and \fBeven\.pdf\fP to create the output file\. This is very useful if you only have a simplex scanner: First you scan the front sides, creating \fBodd\.pdf\fP, and then you scan the back sides, creating \fBeven\.pdf\fP\&\. With the command the pages can be ordered in the correct way\.
511
- .SS "modify"
512
- \fBhexapdf modify input\.pdf \-i 1\-5,7\-10,12\-e output\.pdf\fP
513
- .P
514
- Page removal: Remove the pages 6 and 11 from the \fBinput\.pdf\fP\&\.
515
- .P
516
- \fBhexapdf modify input\.pdf \-i 1r,2\-ed output\.pdf\fP
517
- .P
518
- Page rotation: Rotate the first page to the right, that is 90 degrees clockwise, and all other pages 180 degrees\.
519
- .P
520
- \fBhexapdf modify input\.pdf \-\-user\-password my_pwd \-\-permissions print output\.pdf\fP
521
- .P
522
- Encryption: Create the \fBoutput\.pdf\fP from the \fBinput\.pdf\fP so that a password is needed to open it, and only allow printing\.
523
- .P
524
- \fBhexapdf modify input\.pdf \-p input_password \-\-decrypt output\.pdf\fP
525
- .P
526
- Encryption removal: Create the \fBoutput\.pdf\fP as copy of \fBinput\.pdf\fP but with the encryption removed\. If the \fB\-\-decrypt\fP was not used, the output file would retain the encryption specification of the input file\.
527
- .SS "optimize"
528
- \fBhexapdf optimize input\.pdf output\.pdf\fP
529
- .P
530
- Optimization: Compress the \fBinput\.pdf\fP to get a smaller file size\.
531
- .SS "split"
532
- \fBhexapdf split input\.pdf out_%02d\.pdf\fP
533
- .P
534
- Split the \fBinput\.pdf\fP into individual pages, naming the output files \fBout_01\.pdf\fP, \fBout_02\.pdf\fP, and so on\.
535
- .SS "watermark"
536
- \fBhexapdf watermark \-w watermark\.pdf \-t stamp input\.pdf output\.pdf\fP
537
- .P
538
- Applies the first page of the \fBwatermark\.pdf\fP as stamp on \fBinput\.pdf\fP\&\.
539
- .P
540
- \fBhexapdf watermark \-w watermark\.pdf \-i 2\-5 \-r all input\.pdf output\.pdf\fP
541
- .P
542
- Cyclically applies the pages 2 to 5 of the \fBwatermark\.pdf\fP as background on \fBinput\.pdf\fP\&\.
543
- .SS "files"
544
- \fBhexapdf files input\.pdf\fP
545
- .br
546
- \fBhexapdf files input\.pdf \-e 1\fP
547
- .P
548
- Embedded files: The first command lists the embedded files in the \fBinput\.pdf\fP, the second one then extracts the embedded file with the index 1\.
549
- .SS "images"
550
- \fBhexapdf images input\.pdf\fP
551
- .br
552
- \fBhexapdf images input\.pdf \-e \-\-prefix images/image\fP
553
- .P
554
- Image info and extraction: The first command lists the images of the \fBinput\.pdf\fP, the second one then extracts the images into the subdirectory \fBimages\fP with the prefix \fBimage\fP\&\.
555
- .SS "image2pdf"
556
- \fBhexapdf image2pdf output\.pdf image1\.jpg image2\.pdf image3\.png\fP
557
- .P
558
- Create a PDF file \fBoutput\.pdf\fP containing three pages with one image per page and the image fitted to the page\.
559
- .SS "info"
560
- \fBhexapdf info input\.pdf\fP
561
- .P
562
- File information: Show general information about the PDF file, like PDF version, number of pages, creator, creation date and encryption related information\.
563
- .SS "inspect"
564
- \fBhexapdf inspect input\.pdf \-o 3\fP
565
- .P
566
- Show the object with the object number 3 of the given PDF file\.
567
- .P
568
- \fBhexapdf inspect input\.pdf\fP
569
- .P
570
- Start the interactive inspection mode\.
571
- .SS "batch"
572
- \fBhexapdf batch \'info {}\' input1\.pdf input2\.pdf input3\.pdf\fP
573
- .P
574
- Execute the info command for all input files\.
575
- .P
576
- \fBhexapdf batch \'optimize \-\-object\-streams delete {} done\-{}\' input1\.pdf input2\.pdf input3\.pdf\fP
577
- .P
578
- Optimize the given input files, creating the three output files \fBdone\-input1\.pdf\fP, \fBdone\-input2\.pdf\fP and \fBdone\-input3\.pdf\fP\&\.
579
- .SH "EXIT STATUS"
580
- The exit status is 0 if no error happened\. Otherwise it is 1\.
581
- .SH "SEE ALSO"
582
- The
583
- .UR http://hexapdf\.gettalong\.org
584
- hexapdf website
585
- .UE
586
- for more information\.
587
- .SH "AUTHOR"
588
- hexapdf was written by Thomas Leitner
589
- .MT t_leitner@gmx\.at
590
- .UE
591
- \&\.
592
- .P
593
- This manual page was written by Thomas Leitner
594
- .MT t_leitner@gmx\.at
595
- .UE
596
- \&\.
@@ -226,5 +226,13 @@ describe HexaPDF::DictionaryFields do
226
226
  @field.convert([0, 1, 2, 3], doc)
227
227
  doc.verify
228
228
  end
229
+
230
+ it "allows conversion to a Rectangle from a HexaPDF::PDFArray" do
231
+ data = HexaPDF::PDFArray.new([0, 1, 2, 3])
232
+ doc = Minitest::Mock.new
233
+ doc.expect(:wrap, :data, [data, type: HexaPDF::Rectangle])
234
+ @field.convert(data, doc)
235
+ doc.verify
236
+ end
229
237
  end
230
238
  end
@@ -40,7 +40,7 @@ describe HexaPDF::Writer do
40
40
  219
41
41
  %%EOF
42
42
  3 0 obj
43
- <</Producer(HexaPDF version 0.11.1)>>
43
+ <</Producer(HexaPDF version 0.11.2)>>
44
44
  endobj
45
45
  xref
46
46
  3 1
@@ -72,7 +72,7 @@ describe HexaPDF::Writer do
72
72
  141
73
73
  %%EOF
74
74
  6 0 obj
75
- <</Producer(HexaPDF version 0.11.1)>>
75
+ <</Producer(HexaPDF version 0.11.2)>>
76
76
  endobj
77
77
  2 0 obj
78
78
  <</Length 10>>stream
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexapdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse
@@ -638,7 +638,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
638
638
  version: '0'
639
639
  requirements: []
640
640
  rubyforge_project:
641
- rubygems_version: 2.7.3
641
+ rubygems_version: 2.7.6.2
642
642
  signing_key:
643
643
  specification_version: 4
644
644
  summary: HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby