node-poppler 9.1.2 → 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/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");
@@ -39,458 +40,21 @@ const PDF_INFO_PATH_REG = /(.+)pdfinfo/u;
39
40
 
40
41
  /**
41
42
  * @typedef {Record<string, OptionDetails>} PopplerAcceptedOptions
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
42
56
  */
43
57
 
44
- /**
45
- * @typedef PdfAttachOptions
46
- * @property {boolean} [printVersionInfo] Print copyright and version info.
47
- * @property {boolean} [replace] Replace embedded file with same name (if it exists).
48
- */
49
-
50
- /**
51
- * @typedef PdfDetachOptions
52
- * @property {boolean} [listEmbedded] List all of the embedded files in the PDF file.
53
- * File names are converted to the text encoding specified by `options.outputEncoding`.
54
- * @property {string} [outputEncoding] Sets the encoding to use for text output.
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.
490
- */
491
-
492
- /** @typedef {(PdfAttachOptions|PdfDetachOptions|PdfFontsOptions|PdfImagesOptions|PdfInfoOptions|PdfSeparateOptions|PdfToCairoOptions|PdfToHtmlOptions|PdfToPpmOptions|PdfToPsOptions|PdfToTextOptions|PdfUniteOptions)} PopplerOptions */
493
-
494
58
  /**
495
59
  * @typedef {object} PopplerExtraOptions
496
60
  * @property {AbortSignal} [signal] An `AbortSignal` that can be used to cancel the operation.
@@ -581,7 +145,6 @@ function execBinary(binary, args, file, options = {}) {
581
145
  * @description Checks each option provided is valid, of the correct type, and can be used by the
582
146
  * specified version of the binary.
583
147
  * @ignore
584
- * @ignore
585
148
  * @param {PopplerAcceptedOptions} acceptedOptions - Object containing accepted options.
586
149
  * @param {PopplerOptions} options - Object containing options to pass to the binary.
587
150
  * @param {string} [version] - Semantic version of the binary.
@@ -699,7 +262,6 @@ class Poppler {
699
262
  if (platform === "win32" && !popplerPath) {
700
263
  try {
701
264
  // @ts-ignore: Optional dependency
702
- // eslint-disable-next-line n/global-require -- Conditional require
703
265
  this.#popplerPath = require("node-poppler-win32");
704
266
  } catch {
705
267
  // Leave #popplerPath empty; the generic "Unable to find ... binaries" error below will fire
@@ -764,469 +326,73 @@ class Poppler {
764
326
  case "pdfAttach":
765
327
  this.#acceptedOptions.set(
766
328
  "pdfAttach",
767
- freeze({
768
- printVersionInfo: { arg: "-v", type: "boolean" },
769
- replace: { arg: "-replace", type: "boolean" },
770
- })
329
+ freeze(require("./options/pdfattach"))
771
330
  );
772
331
  break;
773
332
  case "pdfDetach":
774
333
  this.#acceptedOptions.set(
775
334
  "pdfDetach",
776
- freeze({
777
- listEmbedded: { arg: "-list", type: "boolean" },
778
- outputEncoding: { arg: "-enc", type: "string" },
779
- outputPath: { arg: "-o", type: "string" },
780
- ownerPassword: { arg: "-opw", type: "string" },
781
- printVersionInfo: { arg: "-v", type: "boolean" },
782
- saveAllFiles: { arg: "-saveall", type: "boolean" },
783
- saveFile: {
784
- arg: "-savefile",
785
- type: "string",
786
- minVersion: "0.86.0",
787
- },
788
- saveSpecificFile: { arg: "-save", type: "number" },
789
- userPassword: { arg: "-upw", type: "string" },
790
- })
335
+ freeze(require("./options/pdfdetach"))
791
336
  );
792
337
  break;
793
338
  case "pdfFonts":
794
339
  this.#acceptedOptions.set(
795
340
  "pdfFonts",
796
- freeze({
797
- firstPageToExamine: { arg: "-f", type: "number" },
798
- lastPageToExamine: { arg: "-l", type: "number" },
799
- listSubstitutes: { arg: "-subst", type: "boolean" },
800
- ownerPassword: { arg: "-opw", type: "string" },
801
- printVersionInfo: { arg: "-v", type: "boolean" },
802
- userPassword: { arg: "-upw", type: "string" },
803
- })
341
+ freeze(require("./options/pdffonts"))
804
342
  );
805
343
  break;
806
344
  case "pdfImages":
807
345
  this.#acceptedOptions.set(
808
346
  "pdfImages",
809
- freeze({
810
- allFiles: { arg: "-all", type: "boolean" },
811
- ccittFile: { arg: "-ccitt", type: "boolean" },
812
- firstPageToConvert: { arg: "-f", type: "number" },
813
- lastPageToConvert: { arg: "-l", type: "number" },
814
- jbig2File: { arg: "-jbig2", type: "boolean" },
815
- jpeg2000File: { arg: "-jp2", type: "boolean" },
816
- jpegFile: { arg: "-j", type: "boolean" },
817
- list: { arg: "-list", type: "boolean" },
818
- ownerPassword: { arg: "-opw", type: "string" },
819
- pngFile: { arg: "-png", type: "boolean" },
820
- printVersionInfo: { arg: "-v", type: "boolean" },
821
- tiffFile: { arg: "-tiff", type: "boolean" },
822
- userPassword: { arg: "-upw", type: "string" },
823
- })
347
+ freeze(require("./options/pdfimages"))
824
348
  );
825
349
  break;
826
350
  case "pdfInfo":
827
351
  this.#acceptedOptions.set(
828
352
  "pdfInfo",
829
- freeze({
830
- firstPageToConvert: { arg: "-f", type: "number" },
831
- lastPageToConvert: { arg: "-l", type: "number" },
832
- listEncodingOptions: {
833
- arg: "-listenc",
834
- type: "boolean",
835
- },
836
- outputEncoding: { arg: "-enc", type: "string" },
837
- ownerPassword: { arg: "-opw", type: "string" },
838
- printAsJson: { arg: "", type: "boolean" },
839
- printBoundingBoxes: {
840
- arg: "-box",
841
- type: "boolean",
842
- },
843
- printDocStruct: { arg: "-struct", type: "boolean" },
844
- printDocStructText: {
845
- arg: "-struct-text",
846
- type: "boolean",
847
- },
848
- printIsoDates: {
849
- arg: "-isodates",
850
- type: "boolean",
851
- },
852
- printJS: { arg: "-js", type: "boolean" },
853
- printMetadata: { arg: "-meta", type: "boolean" },
854
- printNamedDests: { arg: "-dests", type: "boolean" },
855
- printRawDates: {
856
- arg: "-rawdates",
857
- type: "boolean",
858
- },
859
- printUrls: {
860
- arg: "-url",
861
- type: "boolean",
862
- minVersion: "21.11.0",
863
- },
864
- printVersionInfo: { arg: "-v", type: "boolean" },
865
- userPassword: { arg: "-upw", type: "string" },
866
- })
353
+ freeze(require("./options/pdfinfo"))
867
354
  );
868
355
  break;
869
356
  case "pdfSeparate":
870
357
  this.#acceptedOptions.set(
871
358
  "pdfSeparate",
872
- freeze({
873
- firstPageToExtract: { arg: "-f", type: "number" },
874
- lastPageToExtract: { arg: "-l", type: "number" },
875
- printVersionInfo: { arg: "-v", type: "boolean" },
876
- })
359
+ freeze(require("./options/pdfseparate"))
877
360
  );
878
361
  break;
879
362
  case "pdfToCairo":
880
363
  this.#acceptedOptions.set(
881
364
  "pdfToCairo",
882
- freeze({
883
- antialias: { arg: "-antialias", type: "string" },
884
- cropBox: { arg: "-cropbox", type: "boolean" },
885
- cropHeight: { arg: "-H", type: "number" },
886
- cropSize: { arg: "-sz", type: "number" },
887
- cropWidth: { arg: "-W", type: "number" },
888
- cropXAxis: { arg: "-x", type: "number" },
889
- cropYAxis: { arg: "-y", type: "number" },
890
- duplex: { arg: "-duplex", type: "boolean" },
891
- epsFile: { arg: "-eps", type: "boolean" },
892
- evenPagesOnly: { arg: "-e", type: "boolean" },
893
- fillPage: { arg: "-expand", type: "boolean" },
894
- firstPageToConvert: { arg: "-f", type: "number" },
895
- grayscaleFile: { arg: "-gray", type: "boolean" },
896
- iccFile: { arg: "-icc", type: "string" },
897
- jpegFile: { arg: "-jpeg", type: "boolean" },
898
- jpegOptions: { arg: "-jpegopt", type: "string" },
899
- lastPageToConvert: { arg: "-l", type: "number" },
900
- monochromeFile: { arg: "-mono", type: "boolean" },
901
- noCenter: { arg: "-nocenter", type: "boolean" },
902
- noCrop: { arg: "-nocrop", type: "boolean" },
903
- noShrink: { arg: "-noshrink", type: "boolean" },
904
- oddPagesOnly: { arg: "-o", type: "boolean" },
905
- originalPageSizes: {
906
- arg: "-origpagesizes",
907
- type: "boolean",
908
- },
909
- ownerPassword: { arg: "-opw", type: "string" },
910
- paperHeight: { arg: "-paperh", type: "number" },
911
- paperSize: { arg: "-paper", type: "string" },
912
- paperWidth: { arg: "-paperw", type: "number" },
913
- pdfFile: { arg: "-pdf", type: "boolean" },
914
- pngFile: { arg: "-png", type: "boolean" },
915
- printDocStruct: {
916
- arg: "-struct",
917
- type: "boolean",
918
- minVersion: "23.11.0",
919
- },
920
- printVersionInfo: { arg: "-v", type: "boolean" },
921
- psFile: { arg: "-ps", type: "boolean" },
922
- psLevel2: { arg: "-level2", type: "boolean" },
923
- psLevel3: { arg: "-level3", type: "boolean" },
924
- quiet: { arg: "-q", type: "boolean" },
925
- resolutionXAxis: { arg: "-rx", type: "number" },
926
- resolutionXYAxis: { arg: "-r", type: "number" },
927
- resolutionYAxis: { arg: "-ry", type: "number" },
928
- scalePageTo: { arg: "-scale-to", type: "number" },
929
- scalePageToXAxis: {
930
- arg: "-scale-to-x",
931
- type: "number",
932
- },
933
- scalePageToYAxis: {
934
- arg: "-scale-to-y",
935
- type: "number",
936
- },
937
- singleFile: { arg: "-singlefile", type: "boolean" },
938
- svgFile: { arg: "-svg", type: "boolean" },
939
- tiffCompression: {
940
- arg: "-tiffcompression",
941
- type: "string",
942
- },
943
- tiffFile: { arg: "-tiff", type: "boolean" },
944
- transparentPageColor: {
945
- arg: "-transp",
946
- type: "boolean",
947
- },
948
- userPassword: { arg: "-upw", type: "string" },
949
- })
365
+ freeze(require("./options/pdftocairo"))
950
366
  );
951
367
  break;
952
368
  case "pdfToHtml":
953
369
  this.#acceptedOptions.set(
954
370
  "pdfToHtml",
955
- freeze({
956
- complexOutput: { arg: "-c", type: "boolean" },
957
- dataUrls: {
958
- arg: "-dataurls",
959
- type: "boolean",
960
- minVersion: "0.75.0",
961
- },
962
- exchangePdfLinks: { arg: "-p", type: "boolean" },
963
- extractHidden: { arg: "-hidden", type: "boolean" },
964
- firstPageToConvert: { arg: "-f", type: "number" },
965
- fontFullName: {
966
- arg: "-fontfullname",
967
- type: "boolean",
968
- },
969
- ignoreImages: { arg: "-i", type: "boolean" },
970
- imageFormat: { arg: "-fmt", type: "string" },
971
- lastPageToConvert: { arg: "-l", type: "number" },
972
- noDrm: { arg: "-nodrm", type: "boolean" },
973
- noFrames: { arg: "-noframes", type: "boolean" },
974
- noMergeParagraph: {
975
- arg: "-nomerge",
976
- type: "boolean",
977
- },
978
- noRoundedCoordinates: {
979
- arg: "-noroundcoord",
980
- type: "boolean",
981
- },
982
- outputEncoding: { arg: "-enc", type: "string" },
983
- ownerPassword: { arg: "-opw", type: "string" },
984
- printVersionInfo: { arg: "-v", type: "boolean" },
985
- quiet: { arg: "-q", type: "boolean" },
986
- singlePage: { arg: "-s", type: "boolean" },
987
- stdout: { arg: "-stdout", type: "boolean" },
988
- userPassword: { arg: "-upw", type: "string" },
989
- wordBreakThreshold: { arg: "-wbt", type: "number" },
990
- xmlOutput: { arg: "-xml", type: "boolean" },
991
- zoom: { arg: "-zoom", type: "number" },
992
- })
371
+ freeze(require("./options/pdftohtml"))
993
372
  );
994
373
  break;
995
374
  case "pdfToPpm":
996
375
  this.#acceptedOptions.set(
997
376
  "pdfToPpm",
998
- freeze({
999
- antialiasFonts: { arg: "-aa", type: "string" },
1000
- antialiasVectors: {
1001
- arg: "-aaVector",
1002
- type: "string",
1003
- },
1004
- cropBox: { arg: "-cropbox", type: "boolean" },
1005
- cropHeight: { arg: "-H", type: "number" },
1006
- cropSize: { arg: "-sz", type: "number" },
1007
- cropWidth: { arg: "-W", type: "number" },
1008
- cropXAxis: { arg: "-x", type: "number" },
1009
- cropYAxis: { arg: "-y", type: "number" },
1010
- defaultCmykProfile: {
1011
- arg: "-defaultcmykprofile",
1012
- type: "string",
1013
- minVersion: "21.01.0",
1014
- },
1015
- defaultGrayProfile: {
1016
- arg: "-defaultgrayprofile",
1017
- type: "string",
1018
- minVersion: "21.01.0",
1019
- },
1020
- defaultRgbProfile: {
1021
- arg: "-defaultrgbprofile",
1022
- type: "string",
1023
- minVersion: "21.01.0",
1024
- },
1025
- displayProfile: {
1026
- arg: "-displayprofile",
1027
- type: "string",
1028
- minVersion: "0.90.0",
1029
- },
1030
- evenPagesOnly: { arg: "-e", type: "boolean" },
1031
- firstPageToConvert: { arg: "-f", type: "number" },
1032
- forcePageNumber: {
1033
- arg: "-forcenum",
1034
- type: "boolean",
1035
- minVersion: "0.75.0",
1036
- },
1037
- freetype: { arg: "-freetype", type: "string" },
1038
- grayscaleFile: { arg: "-gray", type: "boolean" },
1039
- hideAnnotations: {
1040
- arg: "-hide-annotations",
1041
- type: "boolean",
1042
- minVersion: "0.84.0",
1043
- },
1044
- jpegFile: { arg: "-jpeg", type: "boolean" },
1045
- lastPageToConvert: { arg: "-l", type: "number" },
1046
- monochromeFile: { arg: "-mono", type: "boolean" },
1047
- oddPagesOnly: { arg: "-o", type: "boolean" },
1048
- ownerPassword: { arg: "-opw", type: "string" },
1049
- pngFile: { arg: "-png", type: "boolean" },
1050
- printProgress: {
1051
- arg: "-progress",
1052
- type: "boolean",
1053
- minVersion: "21.03.0",
1054
- },
1055
- printVersionInfo: { arg: "-v", type: "boolean" },
1056
- quiet: { arg: "-q", type: "boolean" },
1057
- resolutionXAxis: { arg: "-rx", type: "number" },
1058
- resolutionXYAxis: { arg: "-r", type: "number" },
1059
- resolutionYAxis: { arg: "-ry", type: "number" },
1060
- scalePageTo: { arg: "-scale-to", type: "number" },
1061
- scalePageToXAxis: {
1062
- arg: "-scale-to-x",
1063
- type: "number",
1064
- },
1065
- scalePageToYAxis: {
1066
- arg: "-scale-to-y",
1067
- type: "number",
1068
- },
1069
- separator: {
1070
- arg: "-sep",
1071
- type: "string",
1072
- minVersion: "0.75.0",
1073
- },
1074
- singleFile: { arg: "-singlefile", type: "boolean" },
1075
- thinLineMode: {
1076
- arg: "-thinlinemode",
1077
- type: "string",
1078
- },
1079
- tiffCompression: {
1080
- arg: "-tiffcompression",
1081
- type: "string",
1082
- },
1083
- tiffFile: { arg: "-tiff", type: "boolean" },
1084
- userPassword: { arg: "-upw", type: "string" },
1085
- })
377
+ freeze(require("./options/pdftoppm"))
1086
378
  );
1087
379
  break;
1088
380
  case "pdfToPs":
1089
381
  this.#acceptedOptions.set(
1090
382
  "pdfToPs",
1091
- freeze({
1092
- antialias: { arg: "-aaRaster", type: "string" },
1093
- binary: { arg: "-binary", type: "boolean" },
1094
- defaultCmykProfile: {
1095
- arg: "-defaultcmykprofile",
1096
- type: "string",
1097
- minVersion: "21.01.0",
1098
- },
1099
- defaultGrayProfile: {
1100
- arg: "-defaultgrayprofile",
1101
- type: "string",
1102
- minVersion: "21.01.0",
1103
- },
1104
- defaultRgbProfile: {
1105
- arg: "-defaultrgbprofile",
1106
- type: "string",
1107
- minVersion: "21.01.0",
1108
- },
1109
- duplex: { arg: "-duplex", type: "boolean" },
1110
- epsFile: { arg: "-eps", type: "boolean" },
1111
- fillPage: { arg: "-expand", type: "boolean" },
1112
- firstPageToConvert: { arg: "-f", type: "number" },
1113
- form: { arg: "-form", type: "boolean" },
1114
- lastPageToConvert: { arg: "-l", type: "number" },
1115
- level1: { arg: "-level1", type: "boolean" },
1116
- level1Sep: { arg: "-level1sep", type: "boolean" },
1117
- level2: { arg: "-level2", type: "boolean" },
1118
- level2Sep: { arg: "-level2sep", type: "boolean" },
1119
- level3: { arg: "-level3", type: "boolean" },
1120
- level3Sep: { arg: "-level3sep", type: "boolean" },
1121
- noCenter: { arg: "-nocenter", type: "boolean" },
1122
- noCrop: { arg: "-nocrop", type: "boolean" },
1123
- noEmbedCIDFonts: {
1124
- arg: "-noembcidps",
1125
- type: "boolean",
1126
- },
1127
- noEmbedCIDTrueTypeFonts: {
1128
- arg: "-noembcidtt",
1129
- type: "boolean",
1130
- },
1131
- noEmbedTrueTypeFonts: {
1132
- arg: "-noembtt",
1133
- type: "boolean",
1134
- },
1135
- noEmbedType1Fonts: {
1136
- arg: "-noembt1",
1137
- type: "boolean",
1138
- },
1139
- noShrink: { arg: "-noshrink", type: "boolean" },
1140
- opi: { arg: "-opi", type: "boolean" },
1141
- optimizecolorspace: {
1142
- arg: "-optimizecolorspace",
1143
- type: "boolean",
1144
- },
1145
- originalPageSizes: {
1146
- arg: "-origpagesizes",
1147
- type: "boolean",
1148
- },
1149
- overprint: { arg: "-overprint", type: "boolean" },
1150
- ownerPassword: { arg: "-opw", type: "string" },
1151
- paperHeight: { arg: "-paperh", type: "number" },
1152
- paperSize: { arg: "-paper", type: "string" },
1153
- paperWidth: { arg: "-paperw", type: "number" },
1154
- passfonts: { arg: "-passfonts", type: "boolean" },
1155
- preload: { arg: "-preload", type: "boolean" },
1156
- printVersionInfo: { arg: "-v", type: "boolean" },
1157
- processColorFormat: {
1158
- arg: "-processcolorformat",
1159
- type: "string",
1160
- },
1161
- processColorProfile: {
1162
- arg: "-processcolorprofile",
1163
- type: "string",
1164
- },
1165
- quiet: { arg: "-q", type: "boolean" },
1166
- rasterize: {
1167
- arg: "-rasterize",
1168
- type: "string",
1169
- minVersion: "0.90.0",
1170
- },
1171
- resolutionXYAxis: { arg: "-r", type: "number" },
1172
- userPassword: { arg: "-upw", type: "string" },
1173
- })
383
+ freeze(require("./options/pdftops"))
1174
384
  );
1175
385
  break;
1176
386
  case "pdfToText":
1177
387
  this.#acceptedOptions.set(
1178
388
  "pdfToText",
1179
- freeze({
1180
- boundingBoxXhtml: { arg: "-bbox", type: "boolean" },
1181
- boundingBoxXhtmlLayout: {
1182
- arg: "-bbox-layout",
1183
- type: "boolean",
1184
- },
1185
- cropBox: {
1186
- arg: "-cropbox",
1187
- type: "boolean",
1188
- minVersion: "21.03.0",
1189
- },
1190
- cropHeight: { arg: "-H", type: "number" },
1191
- cropWidth: { arg: "-W", type: "number" },
1192
- cropXAxis: { arg: "-x", type: "number" },
1193
- cropYAxis: { arg: "-y", type: "number" },
1194
- eolConvention: { arg: "-eol", type: "string" },
1195
- firstPageToConvert: { arg: "-f", type: "number" },
1196
- fixedWidthLayout: { arg: "-fixed", type: "number" },
1197
- generateHtmlMetaFile: {
1198
- arg: "-htmlmeta",
1199
- type: "boolean",
1200
- },
1201
- generateTsvFile: { arg: "-tsv", type: "boolean" },
1202
- lastPageToConvert: { arg: "-l", type: "number" },
1203
- listEncodingOptions: {
1204
- arg: "-listenc",
1205
- type: "boolean",
1206
- },
1207
- maintainLayout: { arg: "-layout", type: "boolean" },
1208
- noDiagonalText: {
1209
- arg: "-nodiag",
1210
- type: "boolean",
1211
- minVersion: "0.80.0",
1212
- },
1213
- noPageBreaks: { arg: "-nopgbrk", type: "boolean" },
1214
- outputEncoding: { arg: "-enc", type: "string" },
1215
- ownerPassword: { arg: "-opw", type: "string" },
1216
- printVersionInfo: { arg: "-v", type: "boolean" },
1217
- quiet: { arg: "-q", type: "boolean" },
1218
- rawLayout: { arg: "-raw", type: "boolean" },
1219
- resolution: { arg: "-r", type: "number" },
1220
- userPassword: { arg: "-upw", type: "string" },
1221
- })
389
+ freeze(require("./options/pdftotext"))
1222
390
  );
1223
391
  break;
1224
392
  case "pdfUnite":
1225
393
  this.#acceptedOptions.set(
1226
394
  "pdfUnite",
1227
- freeze({
1228
- printVersionInfo: { arg: "-v", type: "boolean" },
1229
- })
395
+ freeze(require("./options/pdfunite"))
1230
396
  );
1231
397
  break;
1232
398
  }