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.
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @typedef PdfToPsOptions
5
+ * @property {('no'|'yes')} [antialias] Enable anti-aliasing on rasterization, accepts `no` or `yes`.
6
+ * @property {boolean} [binary] Write binary data in Level 1 PostScript. By default,
7
+ * pdftops writes hex-encoded data in Level 1 PostScript. Binary data is non-standard in Level 1
8
+ * PostScript but reduces the file size and can be useful when Level 1 PostScript is required
9
+ * only for its restricted use of PostScript operators.
10
+ * @property {string} [defaultCmykProfile] If Poppler is compiled with colour management support, this option
11
+ * sets the DefaultCMYK color space to the ICC profile stored in the display profile file passed.
12
+ * @property {string} [defaultGrayProfile] If Poppler is compiled with colour management support, this option
13
+ * sets the DefaultGray color space to the ICC profile stored in the display profile file passed.
14
+ * @property {string} [defaultRgbProfile] If Poppler is compiled with colour management support, this option
15
+ * sets the DefaultRGB color space to the ICC profile stored in the display profile file passed.
16
+ * @property {boolean} [duplex] Set the Duplex pagedevice entry in the PostScript file.
17
+ * This tells duplex-capable printers to enable duplexing.
18
+ * @property {boolean} [epsFile] Generate an EPS file. An EPS file contains a single image,
19
+ * so if you use this option with a multi-page PDF file, you must use `options.firstPageToConvert` and
20
+ * `options.lastPageToConvert` to specify a single page.
21
+ * The page size options (originalPageSizes, paperSize, paperWidth, paperHeight) can not be used
22
+ * with this option.
23
+ * @property {boolean} [fillPage] Expand PDF pages smaller than the paper to fill the
24
+ * paper. By default, these pages are not scaled.
25
+ * @property {number} [firstPageToConvert] Specifies the first page to convert.
26
+ * @property {boolean} [form] Generate PostScript form which can be imported by software
27
+ * that understands forms.
28
+ * A form contains a single page, so if you use this option with a multi-page PDF file,
29
+ * you must use `options.firstPageToConvert` and `options.lastPageToConvert` to specify a single page.
30
+ * The `options.level1` option cannot be used with `options.form`.
31
+ * No more than one of the mode options (`options.epsFile`, `options.form`) may be given.
32
+ * @property {number} [lastPageToConvert] Specifies the last page to convert.
33
+ * @property {boolean} [level1] Generate Level 1 PostScript. The resulting PostScript
34
+ * files will be significantly larger (if they contain images), but will print on Level 1 printers.
35
+ * This also converts all images to black and white.
36
+ * @property {boolean} [level1Sep] Generate Level 1 separable PostScript.
37
+ * All colors are converted to CMYK. Images are written with separate stream data for the four components.
38
+ * @property {boolean} [level2] Generate Level 2 PostScript.
39
+ * Level 2 supports color images and image compression. This is the default setting.
40
+ * @property {boolean} [level2Sep] Generate Level 2 separable PostScript. All colors are
41
+ * converted to CMYK. The PostScript separation convention operators are used to handle custom (spot) colors.
42
+ * @property {boolean} [level3] Generate Level 3 PostScript.
43
+ * This enables all Level 2 features plus CID font embedding.
44
+ * @property {boolean} [level3Sep] Generate Level 3 separable PostScript.
45
+ * The separation handling is the same as for `options.level2Sep`.
46
+ * @property {boolean} [noCenter] By default, PDF pages smaller than the paper
47
+ * (after any scaling) are centered on the paper. This option causes them to be aligned to
48
+ * the lower-left corner of the paper instead.
49
+ * @property {boolean} [noCrop] By default, printing output is cropped to the CropBox
50
+ * specified in the PDF file. This option disables cropping.
51
+ * @property {boolean} [noEmbedCIDFonts] By default, any CID PostScript fonts which are
52
+ * embedded in the PDF file are copied into the PostScript file. This option disables that embedding.
53
+ * No attempt is made to substitute for non-embedded CID PostScript fonts.
54
+ * @property {boolean} [noEmbedCIDTrueTypeFonts] By default, any CID TrueType fonts which are
55
+ * embedded in the PDF file are copied into the PostScript file. This option disables that embedding.
56
+ * No attempt is made to substitute for non-embedded CID TrueType fonts.
57
+ * @property {boolean} [noEmbedTrueTypeFonts] By default, any TrueType fonts which are embedded
58
+ * in the PDF file are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead.
59
+ * Embedded fonts make PostScript files larger, but may be necessary for readable output.
60
+ * Also, some PostScript interpreters do not have TrueType rasterizers.
61
+ * @property {boolean} [noEmbedType1Fonts] By default, any Type 1 fonts which are embedded in the PDF file
62
+ * are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead.
63
+ * Embedded fonts make PostScript files larger, but may be necessary for readable output.
64
+ * @property {boolean} [noShrink] Do not scale PDF pages which are larger than the paper.
65
+ * By default, pages larger than the paper are shrunk to fit.
66
+ * @property {boolean} [opi] Generate OPI comments for all images and forms which have OPI information.
67
+ * @property {boolean} [optimizeColorSpace] By default, bitmap images in the PDF pass through to the
68
+ * output PostScript in their original color space, which produces predictable results.
69
+ * This option converts RGB and CMYK images into Gray images if every pixel of the image has equal components.
70
+ * This can fix problems when doing color separations of PDFs that contain embedded black and
71
+ * white images encoded as RGB.
72
+ * @property {boolean} [originalPageSizes] Set the paper size of each page to match
73
+ * the size specified in the PDF file.
74
+ * @property {boolean} [overprint] Enable overprint emulation during rasterization.
75
+ * This option requires `options.processColorFormat` to be CMYK8.
76
+ * @property {string} [ownerPassword] Owner password (for encrypted files).
77
+ * @property {number} [paperHeight] Set the paper height, in points.
78
+ * @property {('A3'|'A4'|'legal'|'letter'|'match')} [paperSize] Set the paper size to one of `'A3'`, `'A4'`,
79
+ * `'legal'`, or `'letter'`. This can also be set to `'match'`, which will set the paper size
80
+ * of each page to match the size specified in the PDF file. If none of the paperSize,
81
+ * paperWidth, or paperHeight options are specified the default is to match the paper size.
82
+ * @property {number} [paperWidth] Set the paper width, in points.
83
+ * @property {boolean} [passFonts] By default, references to non-embedded 8-bit fonts
84
+ * in the PDF file are substituted with the closest Helvetica, Times-Roman, or Courier font.
85
+ * This option passes references to non-embedded fonts through to the PostScript file.
86
+ * @property {boolean} [passLevel1CustomColor] When generating Level 1 separable PostScript,
87
+ * preserve custom colors instead of converting them to CMYK.
88
+ * Has no effect if `options.level1Sep` is not set.
89
+ * @property {boolean} [preload] Preload images and forms.
90
+ * @property {boolean} [printVersionInfo] Print copyright and version information.
91
+ * @property {('CMYK8'|'MONO8'|'RGB8')} [processColorFormat] Sets the process color format as it is used
92
+ * during rasterization and transparency reduction.
93
+ *
94
+ * The default depends on the other settings: For `options.level1` the default is `'MONO8'`; for `options.level1Sep`,
95
+ * `options.level2Sep`, `options.level3Sep`, or `options.overprint` the default is `'CMYK8'`; in all other
96
+ * cases `'RGB8'` is the default.
97
+ * If `options.processColorProfile` is set then `options.processColorFormat` is inferred from the specified ICC profile.
98
+ * @property {string} [processColorProfile] Sets the ICC profile that is assumed during
99
+ * rasterization and transparency reduction.
100
+ * @property {boolean} [quiet] Do not print any messages or errors.
101
+ * @property {('always'|'never'|'whenneeded')} [rasterize] By default, pdfToPs rasterizes pages as needed,
102
+ * for example, if they contain transparencies. To force rasterization, set `rasterize` to `'always'`.
103
+ * Use this to eliminate fonts.
104
+ * To prevent rasterization, set `rasterize` to `'never'`.
105
+ * This may produce files that display incorrectly.
106
+ * @property {number} [resolutionXYAxis] Specifies the X and Y resolution, in pixels per
107
+ * inch of image files (or rasterized regions in vector output). The default is `300` PPI.
108
+ * @property {string} [userPassword] User password (for encrypted files).
109
+ */
110
+
111
+ /** @type {Record<keyof PdfToPsOptions, import("../index").OptionDetails>} */
112
+ module.exports = {
113
+ antialias: { arg: "-aaRaster", type: "string" },
114
+ binary: { arg: "-binary", type: "boolean" },
115
+ defaultCmykProfile: {
116
+ arg: "-defaultcmykprofile",
117
+ type: "string",
118
+ minVersion: "21.01.0",
119
+ },
120
+ defaultGrayProfile: {
121
+ arg: "-defaultgrayprofile",
122
+ type: "string",
123
+ minVersion: "21.01.0",
124
+ },
125
+ defaultRgbProfile: {
126
+ arg: "-defaultrgbprofile",
127
+ type: "string",
128
+ minVersion: "21.01.0",
129
+ },
130
+ duplex: { arg: "-duplex", type: "boolean" },
131
+ epsFile: { arg: "-eps", type: "boolean" },
132
+ fillPage: { arg: "-expand", type: "boolean" },
133
+ firstPageToConvert: { arg: "-f", type: "number" },
134
+ form: { arg: "-form", type: "boolean" },
135
+ lastPageToConvert: { arg: "-l", type: "number" },
136
+ level1: { arg: "-level1", type: "boolean" },
137
+ level1Sep: { arg: "-level1sep", type: "boolean" },
138
+ level2: { arg: "-level2", type: "boolean" },
139
+ level2Sep: { arg: "-level2sep", type: "boolean" },
140
+ level3: { arg: "-level3", type: "boolean" },
141
+ level3Sep: { arg: "-level3sep", type: "boolean" },
142
+ noCenter: { arg: "-nocenter", type: "boolean" },
143
+ noCrop: { arg: "-nocrop", type: "boolean" },
144
+ noEmbedCIDFonts: {
145
+ arg: "-noembcidps",
146
+ type: "boolean",
147
+ },
148
+ noEmbedCIDTrueTypeFonts: {
149
+ arg: "-noembcidtt",
150
+ type: "boolean",
151
+ },
152
+ noEmbedTrueTypeFonts: {
153
+ arg: "-noembtt",
154
+ type: "boolean",
155
+ },
156
+ noEmbedType1Fonts: {
157
+ arg: "-noembt1",
158
+ type: "boolean",
159
+ },
160
+ noShrink: { arg: "-noshrink", type: "boolean" },
161
+ opi: { arg: "-opi", type: "boolean" },
162
+ optimizeColorSpace: {
163
+ arg: "-optimizecolorspace",
164
+ type: "boolean",
165
+ minVersion: "0.32.0",
166
+ },
167
+ originalPageSizes: {
168
+ arg: "-origpagesizes",
169
+ type: "boolean",
170
+ },
171
+ overprint: { arg: "-overprint", type: "boolean" },
172
+ ownerPassword: { arg: "-opw", type: "string" },
173
+ paperHeight: { arg: "-paperh", type: "number" },
174
+ paperSize: { arg: "-paper", type: "string" },
175
+ paperWidth: { arg: "-paperw", type: "number" },
176
+ passFonts: { arg: "-passfonts", type: "boolean" },
177
+ passLevel1CustomColor: { arg: "-passlevel1customcolor", type: "boolean" },
178
+ preload: { arg: "-preload", type: "boolean" },
179
+ printVersionInfo: { arg: "-v", type: "boolean" },
180
+ processColorFormat: {
181
+ arg: "-processcolorformat",
182
+ type: "string",
183
+ },
184
+ processColorProfile: {
185
+ arg: "-processcolorprofile",
186
+ type: "string",
187
+ },
188
+ quiet: { arg: "-q", type: "boolean" },
189
+ rasterize: {
190
+ arg: "-rasterize",
191
+ type: "string",
192
+ minVersion: "0.32.0",
193
+ },
194
+ resolutionXYAxis: { arg: "-r", type: "number" },
195
+ userPassword: { arg: "-upw", type: "string" },
196
+ };
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @typedef PdfToTextOptions
5
+ * @property {boolean} [boundingBoxXhtml] Generate an XHTML file containing bounding
6
+ * box information for each word in the file.
7
+ * @property {boolean} [boundingBoxXhtmlLayout] Generate an XHTML file containing
8
+ * bounding box information for each block, line, and word in the file.
9
+ * @property {number} [columnSpacing] Specifies how much spacing to allow after a word
10
+ * before considering adjacent text to be a new column, measured as a fraction
11
+ * of the font size. Default is `0.7`.
12
+ * @property {boolean} [cropBox] Use the crop box rather than the media box with
13
+ * `options.boundingBoxXhtml` and `options.boundingBoxXhtmlLayout`.
14
+ * @property {number} [cropHeight] Specifies the height of crop area in pixels
15
+ * (image output) or points (vector output).
16
+ * @property {number} [cropWidth] Specifies the width of crop area in pixels
17
+ * (image output) or points (vector output).
18
+ * @property {number} [cropXAxis] Specifies the x-coordinate of the crop area top left
19
+ * corner in pixels (image output) or points (vector output).
20
+ * @property {number} [cropYAxis] Specifies the y-coordinate of the crop area top left
21
+ * corner in pixels (image output) or points (vector output).
22
+ * @property {('dos'|'mac'|'unix')} [eolConvention] Sets the end-of-line convention to use for
23
+ * text output: dos; mac; unix.
24
+ * @property {number} [firstPageToConvert] Specifies the first page to convert.
25
+ * @property {number} [fixedWidthLayout] Assume fixed-pitch (or tabular) text, with the
26
+ * specified character width (in points). This forces physical layout mode.
27
+ * @property {boolean} [generateHtmlMetaFile] Generate simple HTML file, including the
28
+ * meta information. This simply wraps the text in `<pre>` and `</pre>` and prepends the meta headers.
29
+ * @property {boolean} [generateTsvFile] Generate a TSV file containing the bounding box
30
+ * information for each block, line, and word in the file.
31
+ * @property {number} [lastPageToConvert] Specifies the last page to convert.
32
+ * @property {boolean} [listEncodingOptions] List the available encodings.
33
+ * @property {boolean} [maintainLayout] Maintain (as best as possible) the original physical
34
+ * layout of the text. The default is to undo physical layout (columns, hyphenation, etc.) and
35
+ * output the text in reading order.
36
+ * @property {boolean} [noDiagonalText] Discard diagonal text.
37
+ * @property {boolean} [noPageBreaks] Do not insert page breaks (form feed characters)
38
+ * between pages.
39
+ * @property {string} [outputEncoding] Sets the encoding to use for text output.
40
+ * This defaults to `'UTF-8'`.
41
+ * @property {string} [ownerPassword] Owner password (for encrypted files).
42
+ * @property {boolean} [printVersionInfo] Print copyright and version information.
43
+ * @property {boolean} [quiet] Do not print any messages or errors.
44
+ * @property {boolean} [rawLayout] Keep the text in content stream order. This is a
45
+ * hack which often undoes column formatting, etc. Use of raw mode is no longer recommended.
46
+ * @property {('all'|'none'|'soft')} [removeHyphens] Controls end-of-line hyphen handling:
47
+ * - `'all'` removes end-of-line hyphens (U+002D, U+2010, U+FE63, U+FF0D) and Unicode
48
+ * soft hyphens (U+00AD), merging words across lines (default)
49
+ * - `'none'` keeps all end-of-line hyphens and line breaks unchanged
50
+ * - `'soft'` removes only Unicode soft hyphens (U+00AD), merging words across lines.
51
+ * ASCII and other hyphen characters are preserved
52
+ *
53
+ * This option has no effect when `options.rawLayout` or `options.maintainLayout`
54
+ * are set to `true`.
55
+ * @property {number} [resolution] Specifies the resolution in DPI. Default is `72`.
56
+ * @property {string} [userPassword] User password (for encrypted files).
57
+ */
58
+
59
+ /** @type {Record<keyof PdfToTextOptions, import("../index").OptionDetails>} */
60
+ module.exports = {
61
+ boundingBoxXhtml: { arg: "-bbox", type: "boolean", minVersion: "0.15.1" },
62
+ boundingBoxXhtmlLayout: {
63
+ arg: "-bbox-layout",
64
+ type: "boolean",
65
+ minVersion: "0.36.0",
66
+ },
67
+ columnSpacing: {
68
+ arg: "-colspacing",
69
+ type: "number",
70
+ },
71
+ cropBox: { arg: "-cropbox", type: "boolean", minVersion: "21.03.0" },
72
+ cropHeight: { arg: "-H", type: "number", minVersion: "0.11.0" },
73
+ cropWidth: { arg: "-W", type: "number", minVersion: "0.11.0" },
74
+ cropXAxis: { arg: "-x", type: "number", minVersion: "0.11.0" },
75
+ cropYAxis: { arg: "-y", type: "number", minVersion: "0.11.0" },
76
+ eolConvention: { arg: "-eol", type: "string" },
77
+ firstPageToConvert: { arg: "-f", type: "number" },
78
+ fixedWidthLayout: { arg: "-fixed", type: "number" },
79
+ generateHtmlMetaFile: {
80
+ arg: "-htmlmeta",
81
+ type: "boolean",
82
+ },
83
+ generateTsvFile: { arg: "-tsv", type: "boolean", minVersion: "22.05.0" },
84
+ lastPageToConvert: { arg: "-l", type: "number" },
85
+ listEncodingOptions: {
86
+ arg: "-listenc",
87
+ type: "boolean",
88
+ minVersion: "0.9.0",
89
+ },
90
+ maintainLayout: { arg: "-layout", type: "boolean" },
91
+ noDiagonalText: { arg: "-nodiag", type: "boolean", minVersion: "0.80.0" },
92
+ noPageBreaks: { arg: "-nopgbrk", type: "boolean" },
93
+ outputEncoding: { arg: "-enc", type: "string" },
94
+ ownerPassword: { arg: "-opw", type: "string" },
95
+ printVersionInfo: { arg: "-v", type: "boolean" },
96
+ quiet: { arg: "-q", type: "boolean" },
97
+ rawLayout: { arg: "-raw", type: "boolean" },
98
+ removeHyphens: {
99
+ arg: "-remove-hyphens",
100
+ type: "string",
101
+ minVersion: "26.05.0",
102
+ },
103
+ resolution: { arg: "-r", type: "number" },
104
+ userPassword: { arg: "-upw", type: "string" },
105
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * @typedef PdfUniteOptions
5
+ * @property {boolean} [printVersionInfo] Print copyright and version information.
6
+ */
7
+
8
+ /** @type {Record<keyof PdfUniteOptions, import("../index").OptionDetails>} */
9
+ module.exports = {
10
+ printVersionInfo: { arg: "-v", type: "boolean" },
11
+ };