node-poppler 9.1.1 → 10.0.0
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.
- package/LICENSE +1 -1
- package/README.md +28 -22
- package/package.json +2 -2
- package/src/index.js +68 -891
- package/src/options/pdfattach.js +13 -0
- package/src/options/pdfdetach.js +41 -0
- package/src/options/pdffonts.js +22 -0
- package/src/options/pdfimages.js +48 -0
- package/src/options/pdfinfo.js +65 -0
- package/src/options/pdfseparate.js +17 -0
- package/src/options/pdftocairo.js +169 -0
- package/src/options/pdftohtml.js +71 -0
- package/src/options/pdftoppm.js +171 -0
- package/src/options/pdftops.js +196 -0
- package/src/options/pdftotext.js +105 -0
- package/src/options/pdfunite.js +11 -0
- package/types/index.d.ts +29 -1112
- package/types/options/pdfattach.d.ts +15 -0
- package/types/options/pdfdetach.d.ts +53 -0
- package/types/options/pdffonts.d.ts +32 -0
- package/types/options/pdfimages.d.ts +74 -0
- package/types/options/pdfinfo.d.ts +88 -0
- package/types/options/pdfseparate.d.ts +21 -0
- package/types/options/pdftocairo.d.ts +241 -0
- package/types/options/pdftohtml.d.ts +104 -0
- package/types/options/pdftoppm.d.ts +210 -0
- package/types/options/pdftops.d.ts +237 -0
- package/types/options/pdftotext.d.ts +137 -0
- package/types/options/pdfunite.d.ts +11 -0
package/src/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable n/global-require -- Conditional requires. */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
const { execFile, spawn, spawnSync } = require("node:child_process");
|
|
@@ -34,459 +35,24 @@ const PDF_INFO_PATH_REG = /(.+)pdfinfo/u;
|
|
|
34
35
|
* @property {string} arg The argument to pass to the binary.
|
|
35
36
|
* @property {('boolean'|'number'|'string')} type The type of the option.
|
|
36
37
|
* @property {string} [minVersion] The minimum version of the binary that supports this option.
|
|
37
|
-
* @property {string} [maxVersion] The maximum version of the binary that supports this option
|
|
38
|
+
* @property {string} [maxVersion] The maximum version of the binary that supports this option.
|
|
38
39
|
*/
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* @typedef {Record<string, OptionDetails>} PopplerAcceptedOptions
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @typedef
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @typedef
|
|
52
|
-
* @
|
|
53
|
-
*
|
|
54
|
-
* @
|
|
55
|
-
* This defaults to `UTF-8`.
|
|
56
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
57
|
-
* @property {string} [outputPath] Set the file name used when saving an embedded file with
|
|
58
|
-
* the save option enabled, or the directory if `options.saveall` is used.
|
|
59
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
60
|
-
* @property {boolean} [saveAllFiles] Save all of the embedded files. This uses the file
|
|
61
|
-
* names associated with the embedded files (as printed by `options.listEmbedded`).
|
|
62
|
-
* By default, the files are saved in the current directory; this can be changed
|
|
63
|
-
* with `options.outputPath`.
|
|
64
|
-
* @property {string} [saveFile] Save the specified embedded file.
|
|
65
|
-
* By default, this uses the file name associated with the embedded file (as printed by
|
|
66
|
-
* `options.listEmbedded`); the file name can be changed with `options.outputPath`.
|
|
67
|
-
* @property {number} [saveSpecificFile] Save the specified embedded file.
|
|
68
|
-
* By default, this uses the file name associated with the embedded file (as printed by
|
|
69
|
-
* `options.listEmbedded`); the file name can be changed with `options.outputPath`.
|
|
70
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @typedef PdfFontsOptions
|
|
75
|
-
* @property {number} [firstPageToExamine] Specifies the first page to examine.
|
|
76
|
-
* @property {number} [lastPageToExamine] Specifies the last page to examine.
|
|
77
|
-
* @property {boolean} [listSubstitutes] List the substitute fonts that poppler
|
|
78
|
-
* will use for non-embedded fonts.
|
|
79
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
80
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
81
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @typedef PdfImagesOptions
|
|
86
|
-
* @property {boolean} [allFiles] Write JPEG, JPEG2000, JBIG2, and CCITT images in their native format.
|
|
87
|
-
* CMYK files are written as TIFF files. All other images are written as PNG files.
|
|
88
|
-
* @property {boolean} [ccittFile] Generate CCITT images as CCITT files.
|
|
89
|
-
* @property {number} [firstPageToConvert] Specifies the first page to convert.
|
|
90
|
-
* @property {number} [lastPageToConvert] Specifies the last page to convert.
|
|
91
|
-
* @property {boolean} [jbig2File] Generate JBIG2 images as JBIG2 files.
|
|
92
|
-
* @property {boolean} [jpeg2000File] Generate JPEG2000 images at JP2 files.
|
|
93
|
-
* @property {boolean} [jpegFile] Generate JPEG images as JPEG files.
|
|
94
|
-
* @property {boolean} [list] Instead of writing the images, list the
|
|
95
|
-
* images along with various information for each image.
|
|
96
|
-
* NOTE: Do not specify the outputPrefix with this option.
|
|
97
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
98
|
-
* @property {boolean} [pngFile] Change the default output format to PNG.
|
|
99
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
100
|
-
* @property {boolean} [tiffFile] Change the default output format to TIFF.
|
|
101
|
-
* @property {string} [userPassword] Specify the user password for the PDF file.
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @typedef PdfInfoOptions
|
|
106
|
-
* @property {number} [firstPageToConvert] First page to print.
|
|
107
|
-
* @property {number} [lastPageToConvert] Last page to print.
|
|
108
|
-
* @property {boolean} [listEncodingOptions] List the available encodings.
|
|
109
|
-
* @property {string} [outputEncoding] Sets the encoding to use for text output.
|
|
110
|
-
* This defaults to `UTF-8`.
|
|
111
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
112
|
-
* @property {boolean} [printAsJson] Print result as a JSON object.
|
|
113
|
-
* @property {boolean} [printBoundingBoxes] Prints the page box bounding boxes:
|
|
114
|
-
* MediaBox, CropBox, BleedBox, TrimBox, and ArtBox.
|
|
115
|
-
* @property {boolean} [printDocStruct] Prints the logical document structure
|
|
116
|
-
* of a Tagged-PDF file.
|
|
117
|
-
* @property {boolean} [printDocStructText] Print the textual content along with the
|
|
118
|
-
* document structure of a Tagged-PDF file. Note that extracting text this way might be slow
|
|
119
|
-
* for big PDF files.
|
|
120
|
-
* @property {boolean} [printIsoDates] Prints dates in ISO-8601 format (including the time zone).
|
|
121
|
-
* @property {boolean} [printJS] Prints all JavaScript in the PDF file.
|
|
122
|
-
* @property {boolean} [printMetadata] Prints document-level metadata. (This is the `Metadata`
|
|
123
|
-
* stream from the PDF file's Catalog object).
|
|
124
|
-
* @property {boolean} [printNamedDests] Print a list of all named destinations. If a page range
|
|
125
|
-
* is specified using the `options.firstPageToConvert` and `options.lastPageToConvert` options, only destinations
|
|
126
|
-
* in the page range are listed.
|
|
127
|
-
* @property {boolean} [printRawDates] Prints the raw (undecoded) date strings, directly from the PDF file.
|
|
128
|
-
* @property {boolean} [printUrls] Print all URLs in the PDF; only URLs referenced by PDF objects
|
|
129
|
-
* such as Link Annotations are listed, not URL strings in the text content.
|
|
130
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
131
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @typedef PdfSeparateOptions
|
|
136
|
-
* @property {number} [firstPageToExtract] Specifies the first page to extract.
|
|
137
|
-
* This defaults to page 1.
|
|
138
|
-
* @property {number} [lastPageToExtract] Specifies the last page to extract.
|
|
139
|
-
* This defaults to the last page of the PDF file.
|
|
140
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @typedef PdfToCairoOptions
|
|
145
|
-
* @property {('best'|'default'|'fast'|'good'|'gray'|'none'|'subpixel')} [antialias] Set the cairo
|
|
146
|
-
* antialias option used for text and drawing in image files (or rasterized regions in vector output).
|
|
147
|
-
* @property {boolean} [cropBox] Uses the crop box rather than media box when
|
|
148
|
-
* generating the files (PNG/JPEG/TIFF only).
|
|
149
|
-
* @property {number} [cropHeight] Specifies the height of crop area in pixels
|
|
150
|
-
* (image output) or points (vector output).
|
|
151
|
-
* @property {number} [cropSize] Specifies the size of crop square in pixels
|
|
152
|
-
* (image output) or points (vector output).
|
|
153
|
-
* @property {number} [cropWidth] Specifies the width of crop area in pixels
|
|
154
|
-
* (image output) or points (vector output).
|
|
155
|
-
* @property {number} [cropXAxis] Specifies the x-coordinate of the crop area top left
|
|
156
|
-
* corner in pixels (image output) or points (vector output).
|
|
157
|
-
* @property {number} [cropYAxis] Specifies the y-coordinate of the crop area top left
|
|
158
|
-
* corner in pixels (image output) or points (vector output).
|
|
159
|
-
* @property {boolean} [duplex] Adds the %%IncludeFeature: *Duplex DuplexNoTumble DSC
|
|
160
|
-
* comment to the PostScript file (PS only). This tells the print manager to enable duplexing.
|
|
161
|
-
* @property {boolean} [epsFile] Generate an EPS file. An EPS file contains a single image,
|
|
162
|
-
* so if you use this option with a multi-page PDF file, you must use `options.firstPageToConvert` and
|
|
163
|
-
* `options.lastPageToConvert` to specify a single page.
|
|
164
|
-
* The page size options (originalPageSizes, paperSize, paperWidth, paperHeight) can not be used
|
|
165
|
-
* with this option.
|
|
166
|
-
* @property {boolean} [evenPagesOnly] Generates only the even numbered pages.
|
|
167
|
-
* @property {boolean} [fillPage] Expand PDF pages smaller than the paper to fill the
|
|
168
|
-
* paper (PS,PDF,SVG only). By default, these pages are not scaled.
|
|
169
|
-
* @property {number} [firstPageToConvert] Specifies the first page to convert.
|
|
170
|
-
* @property {boolean} [grayscaleFile] Generate grayscale file (PNG, JPEG, and TIFF only).
|
|
171
|
-
* @property {string} [iccFile] Use the specified ICC file as the output profile
|
|
172
|
-
* (PNG only). The profile will be embedded in the PNG file.
|
|
173
|
-
* @property {boolean} [jpegFile] Generate JPEG file(s).
|
|
174
|
-
* @property {string} [jpegOptions] When used with `options.jpegFile`, this option can
|
|
175
|
-
* be used to control the JPEG compression parameters. It takes a string of the form
|
|
176
|
-
* `"<opt>=<val>[,<opt>=<val>]"`. Currently available options are:
|
|
177
|
-
* - `quality` Selects the JPEG quality value. The value must be an integer between 0 and 100.
|
|
178
|
-
* - `progressive` Select progressive JPEG output. The possible values are "y", "n", indicating
|
|
179
|
-
* progressive (yes) or non-progressive (no), respectively.
|
|
180
|
-
* - `optimize` Sets whether to compute optimal Huffman coding tables for the JPEG output, which
|
|
181
|
-
* will create smaller files but make an extra pass over the data. The value must be "y" or "n",
|
|
182
|
-
* with "y" performing optimization, otherwise the default Huffman tables are used.
|
|
183
|
-
*
|
|
184
|
-
* Example: `"quality=95,optimize=y"`.
|
|
185
|
-
* @property {number} [lastPageToConvert] Specifies the last page to convert.
|
|
186
|
-
* @property {boolean} [monochromeFile] Generate monochrome file (PNG and TIFF only).
|
|
187
|
-
* @property {boolean} [noCenter] By default, PDF pages smaller than the paper
|
|
188
|
-
* (after any scaling) are centered on the paper. This option causes them to be aligned to
|
|
189
|
-
* the lower-left corner of the paper instead (PS,PDF,SVG only).
|
|
190
|
-
* @property {boolean} [noCrop] By default, printing output is cropped to the CropBox
|
|
191
|
-
* specified in the PDF file. This option disables cropping (PS, PDF, SVG only).
|
|
192
|
-
* @property {boolean} [noShrink] Do not scale PDF pages which are larger than the paper
|
|
193
|
-
* (PS,PDF,SVG only). By default, pages larger than the paper are shrunk to fit.
|
|
194
|
-
* @property {boolean} [oddPagesOnly] Generates only the odd numbered pages.
|
|
195
|
-
* @property {boolean} [originalPageSizes] Set the paper size of each page to match
|
|
196
|
-
* the size specified in the PDF file.
|
|
197
|
-
* @property {string} [ownerPassword] Specify the owner password for the PDF file.
|
|
198
|
-
* Providing this will bypass all security restrictions.
|
|
199
|
-
* @property {number} [paperHeight] Set the paper height, in points (PS, PDF, SVG only).
|
|
200
|
-
* @property {('A3'|'A4'|'legal'|'letter'|'match')} [paperSize] Set the paper size to one of `A3`, `A4`,
|
|
201
|
-
* `legal`, or `letter` (PS,PDF,SVG only). This can also be set to `match`, which will set the paper size
|
|
202
|
-
* of each page to match the size specified in the PDF file. If none of the paperSize,
|
|
203
|
-
* paperWidth, or paperHeight options are specified the default is to match the paper size.
|
|
204
|
-
* @property {number} [paperWidth] Set the paper width, in points (PS,PDF,SVG only).
|
|
205
|
-
* @property {boolean} [pdfFile] Generate PDF file.
|
|
206
|
-
* @property {boolean} [pngFile] Generate PNG file(s).
|
|
207
|
-
* @property {boolean} [printVersionInfo] Print copyright and version information.
|
|
208
|
-
* @property {boolean} [printDocStruct] If the input file contains structural information
|
|
209
|
-
* about the document's content, write this information to the output file (PDF only).
|
|
210
|
-
* @property {boolean} [psFile] Generate PS file.
|
|
211
|
-
* @property {boolean} [psLevel2] Generate Level 2 PostScript (PS only).
|
|
212
|
-
* @property {boolean} [psLevel3] Generate Level 3 PostScript (PS only). This enables all
|
|
213
|
-
* Level 2 features plus shading patterns and masked images. This is the default setting.
|
|
214
|
-
* @property {boolean} [quiet] Do not print any messages or errors.
|
|
215
|
-
* @property {number} [resolutionXAxis] Specifies the X resolution, in pixels per inch of
|
|
216
|
-
* image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
217
|
-
* @property {number} [resolutionXYAxis] Specifies the X and Y resolution, in pixels per
|
|
218
|
-
* inch of image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
219
|
-
* @property {number} [resolutionYAxis] Specifies the Y resolution, in pixels per inch of
|
|
220
|
-
* image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
221
|
-
* @property {number} [scalePageTo] Scales the long side of each page (width for landscape
|
|
222
|
-
* pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will
|
|
223
|
-
* be determined by the aspect ratio of the page (PNG/JPEG/TIFF only).
|
|
224
|
-
* @property {number} [scalePageToXAxis] Scales each page horizontally to fit in scale-to-x
|
|
225
|
-
* pixels. If scale-to-y is set to -1, the vertical size will determined by the aspect ratio of
|
|
226
|
-
* the page (PNG/JPEG/TIFF only).
|
|
227
|
-
* @property {number} [scalePageToYAxis] Scales each page vertically to fit in scale-to-y
|
|
228
|
-
* pixels. If scale-to-x is set to -1, the horizontal size will determined by the aspect ratio of
|
|
229
|
-
* the page (PNG/JPEG/TIFF only).
|
|
230
|
-
* @property {boolean} [singleFile] Writes only the first page and does not add digits.
|
|
231
|
-
* Can only be used with `options.jpegFile`, `options.pngFile`, and `options.tiffFile`.
|
|
232
|
-
* @property {boolean} [svgFile] Generate SVG (Scalable Vector Graphics) file.
|
|
233
|
-
* @property {('deflate'|'jpeg'|'lzw'|'none'|'packbits')} [tiffCompression] Set TIFF compression.
|
|
234
|
-
* @property {boolean} [tiffFile] Generate TIFF file(s).
|
|
235
|
-
* @property {boolean} [transparentPageColor] Use a transparent page color
|
|
236
|
-
* instead of white (PNG and TIFF only).
|
|
237
|
-
* @property {string} [userPassword] Specify the user password for the PDF file.
|
|
238
|
-
*/
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* @typedef PdfToHtmlOptions
|
|
242
|
-
* @property {boolean} [complexOutput] Generate complex output.
|
|
243
|
-
* @property {boolean} [dataUrls] Use data URLs instead of external images in HTML.
|
|
244
|
-
* @property {boolean} [exchangePdfLinks] Exchange .pdf links with .html.
|
|
245
|
-
* @property {boolean} [extractHidden] Force hidden text extraction.
|
|
246
|
-
* @property {number} [firstPageToConvert] First page to print.
|
|
247
|
-
* @property {boolean} [fontFullName] Outputs the font name without any substitutions.
|
|
248
|
-
* @property {boolean} [ignoreImages] Ignore images.
|
|
249
|
-
* @property {('JPG'|'PNG')} [imageFormat] Image file format for Splash output (JPG or PNG).
|
|
250
|
-
* If complexOutput is selected, but imageFormat is not specified, PNG will be assumed.
|
|
251
|
-
* @property {number} [lastPageToConvert] Last page to print.
|
|
252
|
-
* @property {boolean} [noDrm] Override document DRM settings.
|
|
253
|
-
* @property {boolean} [noFrames] Generate no frames. Not supported in complex output mode.
|
|
254
|
-
* @property {boolean} [noMergeParagraph] Do not merge paragraphs.
|
|
255
|
-
* @property {boolean} [noRoundedCoordinates] Do not round coordinates
|
|
256
|
-
* (with XML output only).
|
|
257
|
-
* @property {string} [outputEncoding] Sets the encoding to use for text output.
|
|
258
|
-
* This defaults to `UTF-8`.
|
|
259
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
260
|
-
* @property {boolean} [printVersionInfo] Print copyright and version info.
|
|
261
|
-
* @property {boolean} [quiet] Do not print any messages or errors.
|
|
262
|
-
* @property {boolean} [singlePage] Generate single HTML that includes all pages.
|
|
263
|
-
* @property {boolean} [stdout] Use standard output.
|
|
264
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
265
|
-
* @property {number} [wordBreakThreshold] Adjust the word break threshold percent.
|
|
266
|
-
* Default is 10. Word break occurs when distance between two adjacent characters is greater
|
|
267
|
-
* than this percent of character height.
|
|
268
|
-
* @property {boolean} [xmlOutput] Output for XML post-processing.
|
|
269
|
-
* @property {number} [zoom] Zoom the PDF document (default 1.5).
|
|
270
|
-
*/
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* @typedef PdfToPpmOptions
|
|
274
|
-
* @property {('no'|'yes')} [antialiasFonts] Enable or disable font anti-aliasing.
|
|
275
|
-
* This defaults to `yes`.
|
|
276
|
-
* @property {('no'|'yes')} [antialiasVectors] Enable or disable vector anti-aliasing.
|
|
277
|
-
* This defaults to `yes`.
|
|
278
|
-
* @property {boolean} [cropBox] Uses the crop box rather than media box when
|
|
279
|
-
* generating the files (PNG/JPEG/TIFF only).
|
|
280
|
-
* @property {number} [cropHeight] Specifies the height of crop area in pixels
|
|
281
|
-
* (image output) or points (vector output).
|
|
282
|
-
* @property {number} [cropSize] Specifies the size of crop square in pixels
|
|
283
|
-
* (image output) or points (vector output).
|
|
284
|
-
* @property {number} [cropWidth] Specifies the width of crop area in pixels
|
|
285
|
-
* (image output) or points (vector output).
|
|
286
|
-
* @property {number} [cropXAxis] Specifies the x-coordinate of the crop area top left
|
|
287
|
-
* corner in pixels (image output) or points (vector output).
|
|
288
|
-
* @property {number} [cropYAxis] Specifies the y-coordinate of the crop area top left
|
|
289
|
-
* corner in pixels (image output) or points (vector output).
|
|
290
|
-
* @property {string} [defaultCmykProfile] If Poppler is compiled with colour management support, this option
|
|
291
|
-
* sets the DefaultCMYK color space to the ICC profile stored in the display profile file passed.
|
|
292
|
-
* @property {string} [defaultGrayProfile] If Poppler is compiled with colour management support, this option
|
|
293
|
-
* sets the DefaultGray color space to the ICC profile stored in the display profile file passed.
|
|
294
|
-
* @property {string} [defaultRgbProfile] If Poppler is compiled with colour management support, this option
|
|
295
|
-
* sets the DefaultRGB color space to the ICC profile stored in the display profile file passed.
|
|
296
|
-
* @property {string} [displayProfile] If Poppler is compiled with colour management support, this option
|
|
297
|
-
* sets the display profile to the ICC profile stored in the display profile file passed.
|
|
298
|
-
* @property {boolean} [evenPagesOnly] Generates only the even numbered pages.
|
|
299
|
-
* @property {number} [firstPageToConvert] Specifies the first page to convert.
|
|
300
|
-
* @property {('no'|'yes')} [freetype] Enable or disable FreeType (a TrueType / Type 1 font rasterizer).
|
|
301
|
-
* This defaults to `yes`.
|
|
302
|
-
* @property {boolean} [forcePageNumber] Force page number even if there is only one page.
|
|
303
|
-
* @property {boolean} [grayscaleFile] Generate grayscale PGM file (instead of a color PPM file).
|
|
304
|
-
* @property {boolean} [hideAnnotations] Hide annotations.
|
|
305
|
-
* @property {boolean} [jpegFile] Generate JPEG file instead a PPM file.
|
|
306
|
-
* @property {number} [lastPageToConvert] Specifies the last page to convert.
|
|
307
|
-
* @property {boolean} [monochromeFile] Generate monochrome PBM file (instead of a color PPM file).
|
|
308
|
-
* @property {boolean} [oddPagesOnly] Generates only the odd numbered pages.
|
|
309
|
-
* @property {string} [ownerPassword] Specify the owner password for the PDF file.
|
|
310
|
-
* Providing this will bypass all security restrictions.
|
|
311
|
-
* @property {boolean} [pngFile] Generate PNG file instead a PPM file.
|
|
312
|
-
* @property {boolean} [printProgress] Print progress info as each page is generated.
|
|
313
|
-
* Three space-separated fields are printed to STDERR: the number of the current page, the number
|
|
314
|
-
* of the last page that will be generated, and the path to the file written to.
|
|
315
|
-
* @property {boolean} [printVersionInfo] Print copyright and version information.
|
|
316
|
-
* @property {boolean} [quiet] Do not print any messages or errors.
|
|
317
|
-
* @property {number} [resolutionXAxis] Specifies the X resolution, in pixels per inch of
|
|
318
|
-
* image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
319
|
-
* @property {number} [resolutionXYAxis] Specifies the X and Y resolution, in pixels per
|
|
320
|
-
* inch of image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
321
|
-
* @property {number} [resolutionYAxis] Specifies the Y resolution, in pixels per inch of
|
|
322
|
-
* image files (or rasterized regions in vector output). The default is 150 PPI.
|
|
323
|
-
* @property {number} [scalePageTo] Scales the long side of each page (width for landscape
|
|
324
|
-
* pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will
|
|
325
|
-
* be determined by the aspect ratio of the page.
|
|
326
|
-
* @property {number} [scalePageToXAxis] Scales each page horizontally to fit in scale-to-x
|
|
327
|
-
* pixels. If scale-to-y is set to -1, the vertical size will determined by the aspect ratio of
|
|
328
|
-
* the page.
|
|
329
|
-
* @property {number} [scalePageToYAxis] Scales each page vertically to fit in scale-to-y
|
|
330
|
-
* pixels. If scale-to-x is set to -1, the horizontal size will determined by the aspect ratio of
|
|
331
|
-
* the page.
|
|
332
|
-
* @property {string} [separator] Specify single character separator between name and page number.
|
|
333
|
-
* @property {boolean} [singleFile] Writes only the first page and does not add digits.
|
|
334
|
-
* @property {('none'|'shape'|'solid')} [thinLineMode] Specifies the thin line mode. This defaults to `none`.
|
|
335
|
-
* @property {('deflate'|'jpeg'|'lzw'|'none'|'packbits')} [tiffCompression] Set TIFF compression.
|
|
336
|
-
* @property {boolean} [tiffFile] Generate TIFF file instead a PPM file.
|
|
337
|
-
* @property {string} [userPassword] Specify the user password for the PDF file.
|
|
338
|
-
*/
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* @typedef PdfToPsOptions
|
|
342
|
-
* @property {('no'|'yes')} [antialias] Enable anti-aliasing on rasterization, accepts `no` or `yes`.
|
|
343
|
-
* @property {boolean} [binary] Write binary data in Level 1 PostScript. By default,
|
|
344
|
-
* pdftops writes hex-encoded data in Level 1 PostScript. Binary data is non-standard in Level 1
|
|
345
|
-
* PostScript but reduces the file size and can be useful when Level 1 PostScript is required
|
|
346
|
-
* only for its restricted use of PostScript operators.
|
|
347
|
-
* @property {string} [defaultCmykProfile] If Poppler is compiled with colour management support, this option
|
|
348
|
-
* sets the DefaultCMYK color space to the ICC profile stored in the display profile file passed.
|
|
349
|
-
* @property {string} [defaultGrayProfile] If Poppler is compiled with colour management support, this option
|
|
350
|
-
* sets the DefaultGray color space to the ICC profile stored in the display profile file passed.
|
|
351
|
-
* @property {string} [defaultRgbProfile] If Poppler is compiled with colour management support, this option
|
|
352
|
-
* sets the DefaultRGB color space to the ICC profile stored in the display profile file passed.
|
|
353
|
-
* @property {boolean} [duplex] Set the Duplex pagedevice entry in the PostScript file.
|
|
354
|
-
* This tells duplex-capable printers to enable duplexing.
|
|
355
|
-
* @property {boolean} [epsFile] Generate an EPS file. An EPS file contains a single image,
|
|
356
|
-
* so if you use this option with a multi-page PDF file, you must use `options.firstPageToConvert` and
|
|
357
|
-
* `options.lastPageToConvert` to specify a single page.
|
|
358
|
-
* The page size options (originalPageSizes, paperSize, paperWidth, paperHeight) can not be used
|
|
359
|
-
* with this option.
|
|
360
|
-
* @property {boolean} [fillPage] Expand PDF pages smaller than the paper to fill the
|
|
361
|
-
* paper. By default, these pages are not scaled.
|
|
362
|
-
* @property {number} [firstPageToConvert] Specifies the first page to convert.
|
|
363
|
-
* @property {number} [form] Generate PostScript form which can be imported by software
|
|
364
|
-
* that understands forms.
|
|
365
|
-
* A form contains a single page, so if you use this option with a multi-page PDF file,
|
|
366
|
-
* you must use `options.firstPageToConvert` and `options.lastPageToConvert` to specify a single page.
|
|
367
|
-
* The `options.level1` option cannot be used with `options.form`.
|
|
368
|
-
* No more than one of the mode options (`options.epsFile`, `options.form`) may be given.
|
|
369
|
-
* @property {number} [lastPageToConvert] Specifies the last page to convert.
|
|
370
|
-
* @property {boolean} [level1] Generate Level 1 PostScript. The resulting PostScript
|
|
371
|
-
* files will be significantly larger (if they contain images), but will print on Level 1 printers.
|
|
372
|
-
* This also converts all images to black and white.
|
|
373
|
-
* @property {boolean} [level1Sep] Generate Level 1 separable PostScript.
|
|
374
|
-
* All colors are converted to CMYK. Images are written with separate stream data for the four components.
|
|
375
|
-
* @property {boolean} [level2] Generate Level 2 PostScript.
|
|
376
|
-
* Level 2 supports color images and image compression. This is the default setting.
|
|
377
|
-
* @property {boolean} [level2Sep] Generate Level 2 separable PostScript. All colors are
|
|
378
|
-
* converted to CMYK. The PostScript separation convention operators are used to handle custom (spot) colors.
|
|
379
|
-
* @property {boolean} [level3] Generate Level 3 PostScript.
|
|
380
|
-
* This enables all Level 2 features plus CID font embedding.
|
|
381
|
-
* @property {boolean} [level3Sep] Generate Level 3 separable PostScript.
|
|
382
|
-
* The separation handling is the same as for `options.level2Sep`.
|
|
383
|
-
* @property {boolean} [noCenter] By default, PDF pages smaller than the paper
|
|
384
|
-
* (after any scaling) are centered on the paper. This option causes them to be aligned to
|
|
385
|
-
* the lower-left corner of the paper instead.
|
|
386
|
-
* @property {boolean} [noCrop] By default, printing output is cropped to the CropBox
|
|
387
|
-
* specified in the PDF file. This option disables cropping.
|
|
388
|
-
* @property {boolean} [noEmbedCIDFonts] By default, any CID PostScript fonts which are
|
|
389
|
-
* embedded in the PDF file are copied into the PostScript file. This option disables that embedding.
|
|
390
|
-
* No attempt is made to substitute for non-embedded CID PostScript fonts.
|
|
391
|
-
* @property {boolean} [noEmbedCIDTrueTypeFonts] By default, any CID TrueType fonts which are
|
|
392
|
-
* embedded in the PDF file are copied into the PostScript file. This option disables that embedding.
|
|
393
|
-
* No attempt is made to substitute for non-embedded CID TrueType fonts.
|
|
394
|
-
* @property {boolean} [noEmbedTrueTypeFonts] By default, any TrueType fonts which are embedded
|
|
395
|
-
* in the PDF file are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead.
|
|
396
|
-
* Embedded fonts make PostScript files larger, but may be necessary for readable output.
|
|
397
|
-
* Also, some PostScript interpreters do not have TrueType rasterizers.
|
|
398
|
-
* @property {boolean} [noEmbedType1Fonts] By default, any Type 1 fonts which are embedded in the PDF file
|
|
399
|
-
* are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead.
|
|
400
|
-
* Embedded fonts make PostScript files larger, but may be necessary for readable output.
|
|
401
|
-
* @property {boolean} [noShrink] Do not scale PDF pages which are larger than the paper.
|
|
402
|
-
* By default, pages larger than the paper are shrunk to fit.
|
|
403
|
-
* @property {boolean} [opi] Generate OPI comments for all images and forms which have OPI information.
|
|
404
|
-
* @property {boolean} [optimizecolorspace] By default, bitmap images in the PDF pass through to the
|
|
405
|
-
* output PostScript in their original color space, which produces predictable results.
|
|
406
|
-
* This option converts RGB and CMYK images into Gray images if every pixel of the image has equal components.
|
|
407
|
-
* This can fix problems when doing color separations of PDFs that contain embedded black and
|
|
408
|
-
* white images encoded as RGB.
|
|
409
|
-
* @property {boolean} [originalPageSizes] Set the paper size of each page to match
|
|
410
|
-
* the size specified in the PDF file.
|
|
411
|
-
* @property {boolean} [overprint] Enable overprinting.
|
|
412
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
413
|
-
* @property {number} [paperHeight] Set the paper height, in points.
|
|
414
|
-
* @property {('A3'|'A4'|'legal'|'letter'|'match')} [paperSize] Set the paper size to one of `A3`, `A4`,
|
|
415
|
-
* `legal`, or `letter`. This can also be set to `match`, which will set the paper size
|
|
416
|
-
* of each page to match the size specified in the PDF file. If none of the paperSize,
|
|
417
|
-
* paperWidth, or paperHeight options are specified the default is to match the paper size.
|
|
418
|
-
* @property {number} [paperWidth] Set the paper width, in points.
|
|
419
|
-
* @property {boolean} [passfonts] By default, references to non-embedded 8-bit fonts
|
|
420
|
-
* in the PDF file are substituted with the closest `Helvetica`, `Times-Roman`, or `Courier` font.
|
|
421
|
-
* This option passes references to non-embedded fonts through to the PostScript file.
|
|
422
|
-
* @property {boolean} [preload] Preload images and forms.
|
|
423
|
-
* @property {boolean} [printVersionInfo] Print copyright and version information.
|
|
424
|
-
* @property {('CMYK8'|'MONO8'|'RGB8')} [processColorFormat] Sets the process color format as it is used
|
|
425
|
-
* during rasterization and transparency reduction.
|
|
426
|
-
*
|
|
427
|
-
* The default depends on the other settings: For `options.level1` the default is MONO8; for `options.level1Sep`,
|
|
428
|
-
* `options.level2Sep`, `options.level3Sep`, or `options.overprint` the default is CMYK8; in all other
|
|
429
|
-
* cases RGB8 is the default.
|
|
430
|
-
* If `option.processColorProfile` is set then `options.processColorFormat` is inferred from the specified ICC profile.
|
|
431
|
-
* @property {string} [processColorProfile] Sets the ICC profile that is assumed during
|
|
432
|
-
* rasterization and transparency reduction.
|
|
433
|
-
* @property {boolean} [quiet] Do not print any messages or errors.
|
|
434
|
-
* @property {('always'|'never'|'whenneeded')} [rasterize] By default, pdfToPs rasterizes pages as needed,
|
|
435
|
-
* for example, if they contain transparencies. To force rasterization, set `rasterize` to `always`.
|
|
436
|
-
* Use this to eliminate fonts.
|
|
437
|
-
* To prevent rasterization, set `rasterize` to `never`.
|
|
438
|
-
* This may produce files that display incorrectly.
|
|
439
|
-
* @property {number} [resolutionXYAxis] Specifies the X and Y resolution, in pixels per
|
|
440
|
-
* inch of image files (or rasterized regions in vector output). The default is 300 PPI.
|
|
441
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
442
|
-
*/
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* @typedef PdfToTextOptions
|
|
446
|
-
* @property {boolean} [boundingBoxXhtml] Generate an XHTML file containing bounding
|
|
447
|
-
* box information for each word in the file.
|
|
448
|
-
* @property {boolean} [boundingBoxXhtmlLayout] Generate an XHTML file containing
|
|
449
|
-
* bounding box information for each block, line, and word in the file.
|
|
450
|
-
* @property {boolean} [cropBox] Use the crop box rather than the media box with
|
|
451
|
-
* `options.boundingBoxXhtml` and `options.boundingBoxXhtmlLayout`.
|
|
452
|
-
* @property {number} [cropHeight] Specifies the height of crop area in pixels
|
|
453
|
-
* (image output) or points (vector output).
|
|
454
|
-
* @property {number} [cropWidth] Specifies the width of crop area in pixels
|
|
455
|
-
* (image output) or points (vector output).
|
|
456
|
-
* @property {number} [cropXAxis] Specifies the x-coordinate of the crop area top left
|
|
457
|
-
* corner in pixels (image output) or points (vector output).
|
|
458
|
-
* @property {number} [cropYAxis] Specifies the y-coordinate of the crop area top left
|
|
459
|
-
* corner in pixels (image output) or points (vector output).
|
|
460
|
-
* @property {('dos'|'mac'|'unix')} [eolConvention] Sets the end-of-line convention to use for
|
|
461
|
-
* text output: dos; mac; unix.
|
|
462
|
-
* @property {number} [firstPageToConvert] Specifies the first page to convert.
|
|
463
|
-
* @property {number} [fixedWidthLayout] Assume fixed-pitch (or tabular) text, with the
|
|
464
|
-
* specified character width (in points). This forces physical layout mode.
|
|
465
|
-
* @property {boolean} [generateHtmlMetaFile] Generate simple HTML file, including the
|
|
466
|
-
* meta information. This simply wraps the text in `<pre>` and `</pre>` and prepends the meta headers.
|
|
467
|
-
* @property {boolean} [generateTsvFile] Generate a TSV file containing the bounding box
|
|
468
|
-
* information for each block, line, and word in the file.
|
|
469
|
-
* @property {number} [lastPageToConvert] Specifies the last page to convert.
|
|
470
|
-
* @property {boolean} [listEncodingOptions] List the available encodings.
|
|
471
|
-
* @property {boolean} [maintainLayout] Maintain (as best as possible) the original physical
|
|
472
|
-
* layout of the text. The default is to undo physical layout (columns, hyphenation, etc.) and
|
|
473
|
-
* output the text in reading order.
|
|
474
|
-
* @property {boolean} [noDiagonalText] Discard diagonal text.
|
|
475
|
-
* @property {boolean} [noPageBreaks] Do not insert page breaks (form feed characters)
|
|
476
|
-
* between pages.
|
|
477
|
-
* @property {string} [outputEncoding] Sets the encoding to use for text output.
|
|
478
|
-
* This defaults to `UTF-8`.
|
|
479
|
-
* @property {string} [ownerPassword] Owner password (for encrypted files).
|
|
480
|
-
* @property {boolean} [printVersionInfo] Print copyright and version information.
|
|
481
|
-
* @property {boolean} [quiet] Do not print any messages or errors.
|
|
482
|
-
* @property {boolean} [rawLayout] Keep the text in content stream order. This is a
|
|
483
|
-
* hack which often undoes column formatting, etc. Use of raw mode is no longer recommended.
|
|
484
|
-
* @property {string} [userPassword] User password (for encrypted files).
|
|
485
|
-
*/
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* @typedef PdfUniteOptions
|
|
489
|
-
* @property {boolean} [printVersionInfo] Print copyright and version information.
|
|
43
|
+
* @typedef {import("./options/pdfattach").PdfAttachOptions} PdfAttachOptions
|
|
44
|
+
* @typedef {import("./options/pdfdetach").PdfDetachOptions} PdfDetachOptions
|
|
45
|
+
* @typedef {import("./options/pdfimages").PdfImagesOptions} PdfImagesOptions
|
|
46
|
+
* @typedef {import("./options/pdffonts").PdfFontsOptions} PdfFontsOptions
|
|
47
|
+
* @typedef {import("./options/pdfinfo").PdfInfoOptions} PdfInfoOptions
|
|
48
|
+
* @typedef {import("./options/pdfseparate").PdfSeparateOptions} PdfSeparateOptions
|
|
49
|
+
* @typedef {import("./options/pdftocairo").PdfToCairoOptions} PdfToCairoOptions
|
|
50
|
+
* @typedef {import("./options/pdftohtml").PdfToHtmlOptions} PdfToHtmlOptions
|
|
51
|
+
* @typedef {import("./options/pdftoppm").PdfToPpmOptions} PdfToPpmOptions
|
|
52
|
+
* @typedef {import("./options/pdftops").PdfToPsOptions} PdfToPsOptions
|
|
53
|
+
* @typedef {import("./options/pdftotext").PdfToTextOptions} PdfToTextOptions
|
|
54
|
+
* @typedef {import("./options/pdfunite").PdfUniteOptions} PdfUniteOptions
|
|
55
|
+
* @typedef {(PdfAttachOptions|PdfDetachOptions|PdfFontsOptions|PdfImagesOptions|PdfInfoOptions|PdfSeparateOptions|PdfToCairoOptions|PdfToHtmlOptions|PdfToPpmOptions|PdfToPsOptions|PdfToTextOptions|PdfUniteOptions)} PopplerOptions
|
|
490
56
|
*/
|
|
491
57
|
|
|
492
58
|
/**
|
|
@@ -576,12 +142,12 @@ function execBinary(binary, args, file, options = {}) {
|
|
|
576
142
|
|
|
577
143
|
/**
|
|
578
144
|
* @author Frazer Smith
|
|
579
|
-
* @description Checks each option provided is valid, of the correct type, and can be used by
|
|
580
|
-
* version of binary.
|
|
145
|
+
* @description Checks each option provided is valid, of the correct type, and can be used by the
|
|
146
|
+
* specified version of the binary.
|
|
581
147
|
* @ignore
|
|
582
148
|
* @param {PopplerAcceptedOptions} acceptedOptions - Object containing accepted options.
|
|
583
|
-
* @param {
|
|
584
|
-
* @param {string} [version] -
|
|
149
|
+
* @param {PopplerOptions} options - Object containing options to pass to the binary.
|
|
150
|
+
* @param {string} [version] - Semantic version of the binary.
|
|
585
151
|
* @returns {string[]} Array of CLI arguments.
|
|
586
152
|
* @throws {Error} If invalid arguments provided.
|
|
587
153
|
*/
|
|
@@ -601,27 +167,34 @@ function parseOptions(acceptedOptions, options, version) {
|
|
|
601
167
|
continue;
|
|
602
168
|
}
|
|
603
169
|
|
|
604
|
-
// @ts-
|
|
170
|
+
// @ts-expect-error: Keys are from options, TS cannot infer this
|
|
605
171
|
const option = options[key];
|
|
606
172
|
const acceptedOption = acceptedOptions[key];
|
|
173
|
+
const optionType = typeof option;
|
|
607
174
|
|
|
608
|
-
if (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
// Arg will be empty for some non-standard options
|
|
612
|
-
if (acceptedOption.arg !== "") {
|
|
613
|
-
args.push(acceptedOption.arg);
|
|
614
|
-
}
|
|
175
|
+
if (optionType === "undefined") {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
615
178
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
179
|
+
if (acceptedOption.type === optionType) {
|
|
180
|
+
// Boolean options set to false won't be passed to the binary; skip arg and version checks
|
|
181
|
+
if (acceptedOption.type === "boolean" && !option) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Arg will be empty for some non-standard options
|
|
186
|
+
if (acceptedOption.arg !== "") {
|
|
187
|
+
args.push(acceptedOption.arg);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (optionType !== "boolean") {
|
|
191
|
+
args.push(option);
|
|
619
192
|
}
|
|
620
193
|
} else {
|
|
621
194
|
invalidArgs.push(
|
|
622
195
|
`Invalid value type provided for option '${key}', expected ${
|
|
623
196
|
acceptedOption.type
|
|
624
|
-
} but received ${
|
|
197
|
+
} but received ${optionType}`
|
|
625
198
|
);
|
|
626
199
|
}
|
|
627
200
|
|
|
@@ -661,11 +234,11 @@ class Poppler {
|
|
|
661
234
|
#acceptedOptions = new Map();
|
|
662
235
|
|
|
663
236
|
/**
|
|
664
|
-
* @param {string} [binPath] - Path
|
|
237
|
+
* @param {string} [binPath] - Path to the directory containing the poppler-utils binaries.
|
|
665
238
|
* If not provided, the constructor will attempt to find the Poppler `pdfinfo` binary
|
|
666
239
|
* in the PATH environment variable and use that as the path for all binaries.
|
|
667
240
|
* For `win32` the binaries are bundled with the package and will be used
|
|
668
|
-
* if
|
|
241
|
+
* if local binaries cannot be found.
|
|
669
242
|
* @throws {Error} If the Poppler binaries cannot be found.
|
|
670
243
|
*/
|
|
671
244
|
constructor(binPath) {
|
|
@@ -676,6 +249,7 @@ class Poppler {
|
|
|
676
249
|
/** @type {string|undefined} */
|
|
677
250
|
this.#popplerPath = binPath;
|
|
678
251
|
} else {
|
|
252
|
+
// Use regex over dirname as `where` on Windows returns a newline-delimited list
|
|
679
253
|
const which = spawnSync(platform === "win32" ? "where" : "which", [
|
|
680
254
|
"pdfinfo",
|
|
681
255
|
]).stdout.toString();
|
|
@@ -688,7 +262,6 @@ class Poppler {
|
|
|
688
262
|
if (platform === "win32" && !popplerPath) {
|
|
689
263
|
try {
|
|
690
264
|
// @ts-ignore: Optional dependency
|
|
691
|
-
// eslint-disable-next-line n/global-require -- Conditional require
|
|
692
265
|
this.#popplerPath = require("node-poppler-win32");
|
|
693
266
|
} catch {
|
|
694
267
|
// Leave #popplerPath empty; the generic "Unable to find ... binaries" error below will fire
|
|
@@ -698,7 +271,7 @@ class Poppler {
|
|
|
698
271
|
|
|
699
272
|
if (!this.#popplerPath) {
|
|
700
273
|
throw new Error(
|
|
701
|
-
`Unable to find ${platform} Poppler binaries, please pass the
|
|
274
|
+
`Unable to find ${platform} Poppler binaries, please pass the path to the binaries' directory as an argument to the Poppler constructor.`
|
|
702
275
|
);
|
|
703
276
|
}
|
|
704
277
|
this.#popplerPath = normalize(this.#popplerPath);
|
|
@@ -719,7 +292,7 @@ class Poppler {
|
|
|
719
292
|
|
|
720
293
|
/**
|
|
721
294
|
* @description Returns the path of the Poppler binaries.
|
|
722
|
-
* @returns {string} Path of Poppler binaries.
|
|
295
|
+
* @returns {string} Path of the Poppler binaries' directory.
|
|
723
296
|
*/
|
|
724
297
|
get path() {
|
|
725
298
|
return this.#popplerPath;
|
|
@@ -734,7 +307,7 @@ class Poppler {
|
|
|
734
307
|
async #getVersion(binary) {
|
|
735
308
|
if (!this.#binVersions.has(binary)) {
|
|
736
309
|
const { stderr } = await execFileAsync(binary, ["-v"]);
|
|
737
|
-
// @ts-
|
|
310
|
+
// @ts-expect-error: parseOptions checks if falsy
|
|
738
311
|
const version = POPPLER_VERSION_REG.exec(stderr)[1];
|
|
739
312
|
this.#binVersions.set(binary, version);
|
|
740
313
|
}
|
|
@@ -753,469 +326,73 @@ class Poppler {
|
|
|
753
326
|
case "pdfAttach":
|
|
754
327
|
this.#acceptedOptions.set(
|
|
755
328
|
"pdfAttach",
|
|
756
|
-
freeze(
|
|
757
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
758
|
-
replace: { arg: "-replace", type: "boolean" },
|
|
759
|
-
})
|
|
329
|
+
freeze(require("./options/pdfattach"))
|
|
760
330
|
);
|
|
761
331
|
break;
|
|
762
332
|
case "pdfDetach":
|
|
763
333
|
this.#acceptedOptions.set(
|
|
764
334
|
"pdfDetach",
|
|
765
|
-
freeze(
|
|
766
|
-
listEmbedded: { arg: "-list", type: "boolean" },
|
|
767
|
-
outputEncoding: { arg: "-enc", type: "string" },
|
|
768
|
-
outputPath: { arg: "-o", type: "string" },
|
|
769
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
770
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
771
|
-
saveAllFiles: { arg: "-saveall", type: "boolean" },
|
|
772
|
-
saveFile: {
|
|
773
|
-
arg: "-savefile",
|
|
774
|
-
type: "string",
|
|
775
|
-
minVersion: "0.86.0",
|
|
776
|
-
},
|
|
777
|
-
saveSpecificFile: { arg: "-save", type: "number" },
|
|
778
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
779
|
-
})
|
|
335
|
+
freeze(require("./options/pdfdetach"))
|
|
780
336
|
);
|
|
781
337
|
break;
|
|
782
338
|
case "pdfFonts":
|
|
783
339
|
this.#acceptedOptions.set(
|
|
784
340
|
"pdfFonts",
|
|
785
|
-
freeze(
|
|
786
|
-
firstPageToExamine: { arg: "-f", type: "number" },
|
|
787
|
-
lastPageToExamine: { arg: "-l", type: "number" },
|
|
788
|
-
listSubstitutes: { arg: "-subst", type: "boolean" },
|
|
789
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
790
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
791
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
792
|
-
})
|
|
341
|
+
freeze(require("./options/pdffonts"))
|
|
793
342
|
);
|
|
794
343
|
break;
|
|
795
344
|
case "pdfImages":
|
|
796
345
|
this.#acceptedOptions.set(
|
|
797
346
|
"pdfImages",
|
|
798
|
-
freeze(
|
|
799
|
-
allFiles: { arg: "-all", type: "boolean" },
|
|
800
|
-
ccittFile: { arg: "-ccitt", type: "boolean" },
|
|
801
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
802
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
803
|
-
jbig2File: { arg: "-jbig2", type: "boolean" },
|
|
804
|
-
jpeg2000File: { arg: "-jp2", type: "boolean" },
|
|
805
|
-
jpegFile: { arg: "-j", type: "boolean" },
|
|
806
|
-
list: { arg: "-list", type: "boolean" },
|
|
807
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
808
|
-
pngFile: { arg: "-png", type: "boolean" },
|
|
809
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
810
|
-
tiffFile: { arg: "-tiff", type: "boolean" },
|
|
811
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
812
|
-
})
|
|
347
|
+
freeze(require("./options/pdfimages"))
|
|
813
348
|
);
|
|
814
349
|
break;
|
|
815
350
|
case "pdfInfo":
|
|
816
351
|
this.#acceptedOptions.set(
|
|
817
352
|
"pdfInfo",
|
|
818
|
-
freeze(
|
|
819
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
820
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
821
|
-
listEncodingOptions: {
|
|
822
|
-
arg: "-listenc",
|
|
823
|
-
type: "boolean",
|
|
824
|
-
},
|
|
825
|
-
outputEncoding: { arg: "-enc", type: "string" },
|
|
826
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
827
|
-
printAsJson: { arg: "", type: "boolean" },
|
|
828
|
-
printBoundingBoxes: {
|
|
829
|
-
arg: "-box",
|
|
830
|
-
type: "boolean",
|
|
831
|
-
},
|
|
832
|
-
printDocStruct: { arg: "-struct", type: "boolean" },
|
|
833
|
-
printDocStructText: {
|
|
834
|
-
arg: "-struct-text",
|
|
835
|
-
type: "boolean",
|
|
836
|
-
},
|
|
837
|
-
printIsoDates: {
|
|
838
|
-
arg: "-isodates",
|
|
839
|
-
type: "boolean",
|
|
840
|
-
},
|
|
841
|
-
printJS: { arg: "-js", type: "boolean" },
|
|
842
|
-
printMetadata: { arg: "-meta", type: "boolean" },
|
|
843
|
-
printNamedDests: { arg: "-dests", type: "boolean" },
|
|
844
|
-
printRawDates: {
|
|
845
|
-
arg: "-rawdates",
|
|
846
|
-
type: "boolean",
|
|
847
|
-
},
|
|
848
|
-
printUrls: {
|
|
849
|
-
arg: "-url",
|
|
850
|
-
type: "boolean",
|
|
851
|
-
minVersion: "21.11.0",
|
|
852
|
-
},
|
|
853
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
854
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
855
|
-
})
|
|
353
|
+
freeze(require("./options/pdfinfo"))
|
|
856
354
|
);
|
|
857
355
|
break;
|
|
858
356
|
case "pdfSeparate":
|
|
859
357
|
this.#acceptedOptions.set(
|
|
860
358
|
"pdfSeparate",
|
|
861
|
-
freeze(
|
|
862
|
-
firstPageToExtract: { arg: "-f", type: "number" },
|
|
863
|
-
lastPageToExtract: { arg: "-l", type: "number" },
|
|
864
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
865
|
-
})
|
|
359
|
+
freeze(require("./options/pdfseparate"))
|
|
866
360
|
);
|
|
867
361
|
break;
|
|
868
362
|
case "pdfToCairo":
|
|
869
363
|
this.#acceptedOptions.set(
|
|
870
364
|
"pdfToCairo",
|
|
871
|
-
freeze(
|
|
872
|
-
antialias: { arg: "-antialias", type: "string" },
|
|
873
|
-
cropBox: { arg: "-cropbox", type: "boolean" },
|
|
874
|
-
cropHeight: { arg: "-H", type: "number" },
|
|
875
|
-
cropSize: { arg: "-sz", type: "number" },
|
|
876
|
-
cropWidth: { arg: "-W", type: "number" },
|
|
877
|
-
cropXAxis: { arg: "-x", type: "number" },
|
|
878
|
-
cropYAxis: { arg: "-y", type: "number" },
|
|
879
|
-
duplex: { arg: "-duplex", type: "boolean" },
|
|
880
|
-
epsFile: { arg: "-eps", type: "boolean" },
|
|
881
|
-
evenPagesOnly: { arg: "-e", type: "boolean" },
|
|
882
|
-
fillPage: { arg: "-expand", type: "boolean" },
|
|
883
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
884
|
-
grayscaleFile: { arg: "-gray", type: "boolean" },
|
|
885
|
-
iccFile: { arg: "-icc", type: "string" },
|
|
886
|
-
jpegFile: { arg: "-jpeg", type: "boolean" },
|
|
887
|
-
jpegOptions: { arg: "-jpegopt", type: "string" },
|
|
888
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
889
|
-
monochromeFile: { arg: "-mono", type: "boolean" },
|
|
890
|
-
noCenter: { arg: "-nocenter", type: "boolean" },
|
|
891
|
-
noCrop: { arg: "-nocrop", type: "boolean" },
|
|
892
|
-
noShrink: { arg: "-noshrink", type: "boolean" },
|
|
893
|
-
oddPagesOnly: { arg: "-o", type: "boolean" },
|
|
894
|
-
originalPageSizes: {
|
|
895
|
-
arg: "-origpagesizes",
|
|
896
|
-
type: "boolean",
|
|
897
|
-
},
|
|
898
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
899
|
-
paperHeight: { arg: "-paperh", type: "number" },
|
|
900
|
-
paperSize: { arg: "-paper", type: "string" },
|
|
901
|
-
paperWidth: { arg: "-paperw", type: "number" },
|
|
902
|
-
pdfFile: { arg: "-pdf", type: "boolean" },
|
|
903
|
-
pngFile: { arg: "-png", type: "boolean" },
|
|
904
|
-
printDocStruct: {
|
|
905
|
-
arg: "-struct",
|
|
906
|
-
type: "boolean",
|
|
907
|
-
minVersion: "23.11.0",
|
|
908
|
-
},
|
|
909
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
910
|
-
psFile: { arg: "-ps", type: "boolean" },
|
|
911
|
-
psLevel2: { arg: "-level2", type: "boolean" },
|
|
912
|
-
psLevel3: { arg: "-level3", type: "boolean" },
|
|
913
|
-
quiet: { arg: "-q", type: "boolean" },
|
|
914
|
-
resolutionXAxis: { arg: "-rx", type: "number" },
|
|
915
|
-
resolutionXYAxis: { arg: "-r", type: "number" },
|
|
916
|
-
resolutionYAxis: { arg: "-ry", type: "number" },
|
|
917
|
-
scalePageTo: { arg: "-scale-to", type: "number" },
|
|
918
|
-
scalePageToXAxis: {
|
|
919
|
-
arg: "-scale-to-x",
|
|
920
|
-
type: "number",
|
|
921
|
-
},
|
|
922
|
-
scalePageToYAxis: {
|
|
923
|
-
arg: "-scale-to-y",
|
|
924
|
-
type: "number",
|
|
925
|
-
},
|
|
926
|
-
singleFile: { arg: "-singlefile", type: "boolean" },
|
|
927
|
-
svgFile: { arg: "-svg", type: "boolean" },
|
|
928
|
-
tiffCompression: {
|
|
929
|
-
arg: "-tiffcompression",
|
|
930
|
-
type: "string",
|
|
931
|
-
},
|
|
932
|
-
tiffFile: { arg: "-tiff", type: "boolean" },
|
|
933
|
-
transparentPageColor: {
|
|
934
|
-
arg: "-transp",
|
|
935
|
-
type: "boolean",
|
|
936
|
-
},
|
|
937
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
938
|
-
})
|
|
365
|
+
freeze(require("./options/pdftocairo"))
|
|
939
366
|
);
|
|
940
367
|
break;
|
|
941
368
|
case "pdfToHtml":
|
|
942
369
|
this.#acceptedOptions.set(
|
|
943
370
|
"pdfToHtml",
|
|
944
|
-
freeze(
|
|
945
|
-
complexOutput: { arg: "-c", type: "boolean" },
|
|
946
|
-
dataUrls: {
|
|
947
|
-
arg: "-dataurls",
|
|
948
|
-
type: "boolean",
|
|
949
|
-
minVersion: "0.75.0",
|
|
950
|
-
},
|
|
951
|
-
exchangePdfLinks: { arg: "-p", type: "boolean" },
|
|
952
|
-
extractHidden: { arg: "-hidden", type: "boolean" },
|
|
953
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
954
|
-
fontFullName: {
|
|
955
|
-
arg: "-fontfullname",
|
|
956
|
-
type: "boolean",
|
|
957
|
-
},
|
|
958
|
-
ignoreImages: { arg: "-i", type: "boolean" },
|
|
959
|
-
imageFormat: { arg: "-fmt", type: "string" },
|
|
960
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
961
|
-
noDrm: { arg: "-nodrm", type: "boolean" },
|
|
962
|
-
noFrames: { arg: "-noframes", type: "boolean" },
|
|
963
|
-
noMergeParagraph: {
|
|
964
|
-
arg: "-nomerge",
|
|
965
|
-
type: "boolean",
|
|
966
|
-
},
|
|
967
|
-
noRoundedCoordinates: {
|
|
968
|
-
arg: "-noroundcoord",
|
|
969
|
-
type: "boolean",
|
|
970
|
-
},
|
|
971
|
-
outputEncoding: { arg: "-enc", type: "string" },
|
|
972
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
973
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
974
|
-
quiet: { arg: "-q", type: "boolean" },
|
|
975
|
-
singlePage: { arg: "-s", type: "boolean" },
|
|
976
|
-
stdout: { arg: "-stdout", type: "boolean" },
|
|
977
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
978
|
-
wordBreakThreshold: { arg: "-wbt", type: "number" },
|
|
979
|
-
xmlOutput: { arg: "-xml", type: "boolean" },
|
|
980
|
-
zoom: { arg: "-zoom", type: "number" },
|
|
981
|
-
})
|
|
371
|
+
freeze(require("./options/pdftohtml"))
|
|
982
372
|
);
|
|
983
373
|
break;
|
|
984
374
|
case "pdfToPpm":
|
|
985
375
|
this.#acceptedOptions.set(
|
|
986
376
|
"pdfToPpm",
|
|
987
|
-
freeze(
|
|
988
|
-
antialiasFonts: { arg: "-aa", type: "string" },
|
|
989
|
-
antialiasVectors: {
|
|
990
|
-
arg: "-aaVector",
|
|
991
|
-
type: "string",
|
|
992
|
-
},
|
|
993
|
-
cropBox: { arg: "-cropbox", type: "boolean" },
|
|
994
|
-
cropHeight: { arg: "-H", type: "number" },
|
|
995
|
-
cropSize: { arg: "-sz", type: "number" },
|
|
996
|
-
cropWidth: { arg: "-W", type: "number" },
|
|
997
|
-
cropXAxis: { arg: "-x", type: "number" },
|
|
998
|
-
cropYAxis: { arg: "-y", type: "number" },
|
|
999
|
-
defaultCmykProfile: {
|
|
1000
|
-
arg: "-defaultcmykprofile",
|
|
1001
|
-
type: "string",
|
|
1002
|
-
minVersion: "21.01.0",
|
|
1003
|
-
},
|
|
1004
|
-
defaultGrayProfile: {
|
|
1005
|
-
arg: "-defaultgrayprofile",
|
|
1006
|
-
type: "string",
|
|
1007
|
-
minVersion: "21.01.0",
|
|
1008
|
-
},
|
|
1009
|
-
defaultRgbProfile: {
|
|
1010
|
-
arg: "-defaultrgbprofile",
|
|
1011
|
-
type: "string",
|
|
1012
|
-
minVersion: "21.01.0",
|
|
1013
|
-
},
|
|
1014
|
-
displayProfile: {
|
|
1015
|
-
arg: "-displayprofile",
|
|
1016
|
-
type: "string",
|
|
1017
|
-
minVersion: "0.90.0",
|
|
1018
|
-
},
|
|
1019
|
-
evenPagesOnly: { arg: "-e", type: "boolean" },
|
|
1020
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
1021
|
-
forcePageNumber: {
|
|
1022
|
-
arg: "-forcenum",
|
|
1023
|
-
type: "boolean",
|
|
1024
|
-
minVersion: "0.75.0",
|
|
1025
|
-
},
|
|
1026
|
-
freetype: { arg: "-freetype", type: "string" },
|
|
1027
|
-
grayscaleFile: { arg: "-gray", type: "boolean" },
|
|
1028
|
-
hideAnnotations: {
|
|
1029
|
-
arg: "-hide-annotations",
|
|
1030
|
-
type: "boolean",
|
|
1031
|
-
minVersion: "0.84.0",
|
|
1032
|
-
},
|
|
1033
|
-
jpegFile: { arg: "-jpeg", type: "boolean" },
|
|
1034
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
1035
|
-
monochromeFile: { arg: "-mono", type: "boolean" },
|
|
1036
|
-
oddPagesOnly: { arg: "-o", type: "boolean" },
|
|
1037
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
1038
|
-
pngFile: { arg: "-png", type: "boolean" },
|
|
1039
|
-
printProgress: {
|
|
1040
|
-
arg: "-progress",
|
|
1041
|
-
type: "boolean",
|
|
1042
|
-
minVersion: "21.03.0",
|
|
1043
|
-
},
|
|
1044
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
1045
|
-
quiet: { arg: "-q", type: "boolean" },
|
|
1046
|
-
resolutionXAxis: { arg: "-rx", type: "number" },
|
|
1047
|
-
resolutionXYAxis: { arg: "-r", type: "number" },
|
|
1048
|
-
resolutionYAxis: { arg: "-ry", type: "number" },
|
|
1049
|
-
scalePageTo: { arg: "-scale-to", type: "number" },
|
|
1050
|
-
scalePageToXAxis: {
|
|
1051
|
-
arg: "-scale-to-x",
|
|
1052
|
-
type: "number",
|
|
1053
|
-
},
|
|
1054
|
-
scalePageToYAxis: {
|
|
1055
|
-
arg: "-scale-to-y",
|
|
1056
|
-
type: "number",
|
|
1057
|
-
},
|
|
1058
|
-
separator: {
|
|
1059
|
-
arg: "-sep",
|
|
1060
|
-
type: "string",
|
|
1061
|
-
minVersion: "0.75.0",
|
|
1062
|
-
},
|
|
1063
|
-
singleFile: { arg: "-singlefile", type: "boolean" },
|
|
1064
|
-
thinLineMode: {
|
|
1065
|
-
arg: "-thinlinemode",
|
|
1066
|
-
type: "string",
|
|
1067
|
-
},
|
|
1068
|
-
tiffCompression: {
|
|
1069
|
-
arg: "-tiffcompression",
|
|
1070
|
-
type: "string",
|
|
1071
|
-
},
|
|
1072
|
-
tiffFile: { arg: "-tiff", type: "boolean" },
|
|
1073
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
1074
|
-
})
|
|
377
|
+
freeze(require("./options/pdftoppm"))
|
|
1075
378
|
);
|
|
1076
379
|
break;
|
|
1077
380
|
case "pdfToPs":
|
|
1078
381
|
this.#acceptedOptions.set(
|
|
1079
382
|
"pdfToPs",
|
|
1080
|
-
freeze(
|
|
1081
|
-
antialias: { arg: "-aaRaster", type: "string" },
|
|
1082
|
-
binary: { arg: "-binary", type: "boolean" },
|
|
1083
|
-
defaultCmykProfile: {
|
|
1084
|
-
arg: "-defaultcmykprofile",
|
|
1085
|
-
type: "string",
|
|
1086
|
-
minVersion: "21.01.0",
|
|
1087
|
-
},
|
|
1088
|
-
defaultGrayProfile: {
|
|
1089
|
-
arg: "-defaultgrayprofile",
|
|
1090
|
-
type: "string",
|
|
1091
|
-
minVersion: "21.01.0",
|
|
1092
|
-
},
|
|
1093
|
-
defaultRgbProfile: {
|
|
1094
|
-
arg: "-defaultrgbprofile",
|
|
1095
|
-
type: "string",
|
|
1096
|
-
minVersion: "21.01.0",
|
|
1097
|
-
},
|
|
1098
|
-
duplex: { arg: "-duplex", type: "boolean" },
|
|
1099
|
-
epsFile: { arg: "-eps", type: "boolean" },
|
|
1100
|
-
fillPage: { arg: "-expand", type: "boolean" },
|
|
1101
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
1102
|
-
form: { arg: "-form", type: "boolean" },
|
|
1103
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
1104
|
-
level1: { arg: "-level1", type: "boolean" },
|
|
1105
|
-
level1Sep: { arg: "-level1sep", type: "boolean" },
|
|
1106
|
-
level2: { arg: "-level2", type: "boolean" },
|
|
1107
|
-
level2Sep: { arg: "-level2sep", type: "boolean" },
|
|
1108
|
-
level3: { arg: "-level3", type: "boolean" },
|
|
1109
|
-
level3Sep: { arg: "-level3sep", type: "boolean" },
|
|
1110
|
-
noCenter: { arg: "-nocenter", type: "boolean" },
|
|
1111
|
-
noCrop: { arg: "-nocrop", type: "boolean" },
|
|
1112
|
-
noEmbedCIDFonts: {
|
|
1113
|
-
arg: "-noembcidps",
|
|
1114
|
-
type: "boolean",
|
|
1115
|
-
},
|
|
1116
|
-
noEmbedCIDTrueTypeFonts: {
|
|
1117
|
-
arg: "-noembcidtt",
|
|
1118
|
-
type: "boolean",
|
|
1119
|
-
},
|
|
1120
|
-
noEmbedTrueTypeFonts: {
|
|
1121
|
-
arg: "-noembtt",
|
|
1122
|
-
type: "boolean",
|
|
1123
|
-
},
|
|
1124
|
-
noEmbedType1Fonts: {
|
|
1125
|
-
arg: "-noembt1",
|
|
1126
|
-
type: "boolean",
|
|
1127
|
-
},
|
|
1128
|
-
noShrink: { arg: "-noshrink", type: "boolean" },
|
|
1129
|
-
opi: { arg: "-opi", type: "boolean" },
|
|
1130
|
-
optimizecolorspace: {
|
|
1131
|
-
arg: "-optimizecolorspace",
|
|
1132
|
-
type: "boolean",
|
|
1133
|
-
},
|
|
1134
|
-
originalPageSizes: {
|
|
1135
|
-
arg: "-origpagesizes",
|
|
1136
|
-
type: "boolean",
|
|
1137
|
-
},
|
|
1138
|
-
overprint: { arg: "-overprint", type: "boolean" },
|
|
1139
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
1140
|
-
paperHeight: { arg: "-paperh", type: "number" },
|
|
1141
|
-
paperSize: { arg: "-paper", type: "string" },
|
|
1142
|
-
paperWidth: { arg: "-paperw", type: "number" },
|
|
1143
|
-
passfonts: { arg: "-passfonts", type: "boolean" },
|
|
1144
|
-
preload: { arg: "-preload", type: "boolean" },
|
|
1145
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
1146
|
-
processColorFormat: {
|
|
1147
|
-
arg: "-processcolorformat",
|
|
1148
|
-
type: "string",
|
|
1149
|
-
},
|
|
1150
|
-
processColorProfile: {
|
|
1151
|
-
arg: "-processcolorprofile",
|
|
1152
|
-
type: "string",
|
|
1153
|
-
},
|
|
1154
|
-
quiet: { arg: "-q", type: "boolean" },
|
|
1155
|
-
rasterize: {
|
|
1156
|
-
arg: "-rasterize",
|
|
1157
|
-
type: "string",
|
|
1158
|
-
minVersion: "0.90.0",
|
|
1159
|
-
},
|
|
1160
|
-
resolutionXYAxis: { arg: "-r", type: "number" },
|
|
1161
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
1162
|
-
})
|
|
383
|
+
freeze(require("./options/pdftops"))
|
|
1163
384
|
);
|
|
1164
385
|
break;
|
|
1165
386
|
case "pdfToText":
|
|
1166
387
|
this.#acceptedOptions.set(
|
|
1167
388
|
"pdfToText",
|
|
1168
|
-
freeze(
|
|
1169
|
-
boundingBoxXhtml: { arg: "-bbox", type: "boolean" },
|
|
1170
|
-
boundingBoxXhtmlLayout: {
|
|
1171
|
-
arg: "-bbox-layout",
|
|
1172
|
-
type: "boolean",
|
|
1173
|
-
},
|
|
1174
|
-
cropBox: {
|
|
1175
|
-
arg: "-cropbox",
|
|
1176
|
-
type: "boolean",
|
|
1177
|
-
minVersion: "21.03.0",
|
|
1178
|
-
},
|
|
1179
|
-
cropHeight: { arg: "-H", type: "number" },
|
|
1180
|
-
cropWidth: { arg: "-W", type: "number" },
|
|
1181
|
-
cropXAxis: { arg: "-x", type: "number" },
|
|
1182
|
-
cropYAxis: { arg: "-y", type: "number" },
|
|
1183
|
-
eolConvention: { arg: "-eol", type: "string" },
|
|
1184
|
-
firstPageToConvert: { arg: "-f", type: "number" },
|
|
1185
|
-
fixedWidthLayout: { arg: "-fixed", type: "number" },
|
|
1186
|
-
generateHtmlMetaFile: {
|
|
1187
|
-
arg: "-htmlmeta",
|
|
1188
|
-
type: "boolean",
|
|
1189
|
-
},
|
|
1190
|
-
generateTsvFile: { arg: "-tsv", type: "boolean" },
|
|
1191
|
-
lastPageToConvert: { arg: "-l", type: "number" },
|
|
1192
|
-
listEncodingOptions: {
|
|
1193
|
-
arg: "-listenc",
|
|
1194
|
-
type: "boolean",
|
|
1195
|
-
},
|
|
1196
|
-
maintainLayout: { arg: "-layout", type: "boolean" },
|
|
1197
|
-
noDiagonalText: {
|
|
1198
|
-
arg: "-nodiag",
|
|
1199
|
-
type: "boolean",
|
|
1200
|
-
minVersion: "0.80.0",
|
|
1201
|
-
},
|
|
1202
|
-
noPageBreaks: { arg: "-nopgbrk", type: "boolean" },
|
|
1203
|
-
outputEncoding: { arg: "-enc", type: "string" },
|
|
1204
|
-
ownerPassword: { arg: "-opw", type: "string" },
|
|
1205
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
1206
|
-
quiet: { arg: "-q", type: "boolean" },
|
|
1207
|
-
rawLayout: { arg: "-raw", type: "boolean" },
|
|
1208
|
-
resolution: { arg: "-r", type: "number" },
|
|
1209
|
-
userPassword: { arg: "-upw", type: "string" },
|
|
1210
|
-
})
|
|
389
|
+
freeze(require("./options/pdftotext"))
|
|
1211
390
|
);
|
|
1212
391
|
break;
|
|
1213
392
|
case "pdfUnite":
|
|
1214
393
|
this.#acceptedOptions.set(
|
|
1215
394
|
"pdfUnite",
|
|
1216
|
-
freeze(
|
|
1217
|
-
printVersionInfo: { arg: "-v", type: "boolean" },
|
|
1218
|
-
})
|
|
395
|
+
freeze(require("./options/pdfunite"))
|
|
1219
396
|
);
|
|
1220
397
|
break;
|
|
1221
398
|
}
|
|
@@ -1230,7 +407,7 @@ class Poppler {
|
|
|
1230
407
|
* @param {string} file - Filepath of the PDF file to read.
|
|
1231
408
|
* @param {string} fileToAttach - Filepath of the attachment to be embedded into the PDF file.
|
|
1232
409
|
* @param {string} outputFile - Filepath of the file to output the results to.
|
|
1233
|
-
* @param {PdfAttachOptions} [options] - Options to pass to pdfattach binary.
|
|
410
|
+
* @param {PdfAttachOptions} [options] - Options to pass to the pdfattach binary.
|
|
1234
411
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1235
412
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1236
413
|
*/
|
|
@@ -1247,7 +424,7 @@ class Poppler {
|
|
|
1247
424
|
* @author Frazer Smith
|
|
1248
425
|
* @description Lists or extracts embedded files (attachments) from a PDF file.
|
|
1249
426
|
* @param {string} file - Filepath of the PDF file to read.
|
|
1250
|
-
* @param {PdfDetachOptions} [options] - Options to pass to pdfdetach binary.
|
|
427
|
+
* @param {PdfDetachOptions} [options] - Options to pass to the pdfdetach binary.
|
|
1251
428
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1252
429
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1253
430
|
*/
|
|
@@ -1267,7 +444,7 @@ class Poppler {
|
|
|
1267
444
|
* @author Frazer Smith
|
|
1268
445
|
* @description Lists the fonts used in a PDF file along with various information for each font.
|
|
1269
446
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1270
|
-
* @param {PdfFontsOptions} [options] - Options to pass to pdffonts binary.
|
|
447
|
+
* @param {PdfFontsOptions} [options] - Options to pass to the pdffonts binary.
|
|
1271
448
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1272
449
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1273
450
|
*/
|
|
@@ -1286,7 +463,7 @@ class Poppler {
|
|
|
1286
463
|
* @description Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.
|
|
1287
464
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1288
465
|
* @param {string} [outputPrefix] - Filename prefix of output files.
|
|
1289
|
-
* @param {PdfImagesOptions} [options] - Options to pass to pdfimages binary.
|
|
466
|
+
* @param {PdfImagesOptions} [options] - Options to pass to the pdfimages binary.
|
|
1290
467
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1291
468
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1292
469
|
*/
|
|
@@ -1309,7 +486,7 @@ class Poppler {
|
|
|
1309
486
|
* @author Frazer Smith
|
|
1310
487
|
* @description Prints the contents of the `Info` dictionary from a PDF file.
|
|
1311
488
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1312
|
-
* @param {PdfInfoOptions} [options] - Options to pass to pdfinfo binary.
|
|
489
|
+
* @param {PdfInfoOptions} [options] - Options to pass to the pdfinfo binary.
|
|
1313
490
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1314
491
|
* @returns {Promise<Record<string, string>|string>} A promise that resolves with a stdout string or JSON object if
|
|
1315
492
|
* `options.printAsJson` is `true`, or rejects with an `Error` object.
|
|
@@ -1413,7 +590,7 @@ class Poppler {
|
|
|
1413
590
|
* @param {string} outputPattern - Should contain %d (or any variant respecting printf format),
|
|
1414
591
|
* since %d is replaced by the page number.
|
|
1415
592
|
* As an example, `sample-%d.pdf` will produce `sample-1.pdf` for a single page document.
|
|
1416
|
-
* @param {PdfSeparateOptions} [options] - Options to pass to pdfseparate binary.
|
|
593
|
+
* @param {PdfSeparateOptions} [options] - Options to pass to the pdfseparate binary.
|
|
1417
594
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1418
595
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1419
596
|
*/
|
|
@@ -1438,7 +615,7 @@ class Poppler {
|
|
|
1438
615
|
* Encoding is set to `binary` if used with `options.singleFile` or `options.pdfFile`.
|
|
1439
616
|
*
|
|
1440
617
|
* If not set then the output filename will be derived from the PDF file name.
|
|
1441
|
-
* @param {PdfToCairoOptions} [options] - Options to pass to pdftocairo binary.
|
|
618
|
+
* @param {PdfToCairoOptions} [options] - Options to pass to the pdftocairo binary.
|
|
1442
619
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1443
620
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1444
621
|
*/
|
|
@@ -1468,7 +645,7 @@ class Poppler {
|
|
|
1468
645
|
* and create a new file, with `-html` appended to the end of the filename.
|
|
1469
646
|
*
|
|
1470
647
|
* Required if `file` is a Buffer.
|
|
1471
|
-
* @param {PdfToHtmlOptions} [options] - Options to pass to pdftohtml binary.
|
|
648
|
+
* @param {PdfToHtmlOptions} [options] - Options to pass to the pdftohtml binary.
|
|
1472
649
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1473
650
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1474
651
|
*/
|
|
@@ -1496,7 +673,7 @@ class Poppler {
|
|
|
1496
673
|
* in Portable Bitmap (PBM) format.
|
|
1497
674
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1498
675
|
* @param {string} outputPath - Filepath to output the results to.
|
|
1499
|
-
* @param {PdfToPpmOptions} [options] - Options to pass to pdftoppm binary.
|
|
676
|
+
* @param {PdfToPpmOptions} [options] - Options to pass to the pdftoppm binary.
|
|
1500
677
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1501
678
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1502
679
|
*/
|
|
@@ -1516,7 +693,7 @@ class Poppler {
|
|
|
1516
693
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1517
694
|
* @param {string} [outputFile] - Filepath of the file to output the results to.
|
|
1518
695
|
* If `undefined` then will write output to stdout.
|
|
1519
|
-
* @param {PdfToPsOptions} [options] - Options to pass to pdftops binary.
|
|
696
|
+
* @param {PdfToPsOptions} [options] - Options to pass to the pdftops binary.
|
|
1520
697
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1521
698
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1522
699
|
*/
|
|
@@ -1536,7 +713,7 @@ class Poppler {
|
|
|
1536
713
|
* @param {(Buffer|string)} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1537
714
|
* @param {string} [outputFile] - Filepath of the file to output the results to.
|
|
1538
715
|
* If `undefined` then will write output to stdout.
|
|
1539
|
-
* @param {PdfToTextOptions} [options] - Options to pass to pdftotext binary.
|
|
716
|
+
* @param {PdfToTextOptions} [options] - Options to pass to the pdftotext binary.
|
|
1540
717
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1541
718
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1542
719
|
*/
|
|
@@ -1560,7 +737,7 @@ class Poppler {
|
|
|
1560
737
|
* @param {string[]} files - Filepaths of the PDF files to merge.
|
|
1561
738
|
* An entire directory of PDF files can be merged like so: `path/to/directory/*.pdf`.
|
|
1562
739
|
* @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
|
|
1563
|
-
* @param {PdfUniteOptions} [options] - Options to pass to pdfunite binary.
|
|
740
|
+
* @param {PdfUniteOptions} [options] - Options to pass to the pdfunite binary.
|
|
1564
741
|
* @param {PopplerExtraOptions} [extras] - Extra options.
|
|
1565
742
|
* @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
|
|
1566
743
|
*/
|