- parseOptions(acceptedOptions, options, [version]) ⇒
Promise.<(Array|Error)>
Check each option provided is valid, of the correct type, and can be used by specified version of binary.
Kind: global class
- Poppler
- new Poppler([binPath])
- .pdfAttach(file, fileToAttach, outputFile, [options]) ⇒
Promise.<(string|Error)>
- .pdfDetach(file, [options]) ⇒
Promise.<(string|Error)>
- .pdfFonts(file, [options]) ⇒
Promise.<(string|Error)>
- .pdfImages(file, outputPrefix, [options]) ⇒
Promise.<(string|Error)>
- .pdfInfo(file, [options]) ⇒
Promise.<(string|Error)>
- .pdfSeparate(file, outputPattern, [options]) ⇒
Promise.<(string|Error)>
- .pdfToCairo(file, [outputFile], [options]) ⇒
Promise.<(string|Error)>
- .pdfToHtml(file, [options]) ⇒
Promise.<(string|Error)>
- .pdfToPpm(file, outputPath, [options]) ⇒
Promise.<(string|Error)>
- .pdfToPs(file, [outputFile], [options]) ⇒
Promise.<(string|Error)>
- .pdfToText(file, [outputFile], [options]) ⇒
Promise.<(string|Error)>
- .pdfUnite(files, outputFile, [options]) ⇒
Promise.<(string|Error)>
Param | Type | Description |
---|---|---|
[binPath] | string |
Path of poppler-utils binaries. Useful for Linux users who have poppler-utils binaries already installed. |
Embeds files (attachments) into a PDF file.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
fileToAttach | string |
Filepath of the attachment to be embedded into the PDF file. |
outputFile | string |
Filepath of the file to output the results to. |
[options] | object |
Object containing options to pass to binary. |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.replace] | boolean |
Replace embedded file with same name (if it exists). |
Lists or extracts embedded files (attachments) from a PDF file.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[options] | object |
Object containing options to pass to binary. |
[options.listEmbedded] | boolean |
List all of the embedded files in the PDF file. File names are converted to the text encoding specified by options.outputEncoding . |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.outputEncoding] | string |
Sets the encoding to use for text output. This defaults to UTF-8 . |
[options.outputPath] | string |
Set the file name used when saving an embedded file with the save option enabled, or the directory if options.saveall is used. |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.saveAllFiles] | boolean |
Save all of the embedded files. This uses the file names associated with the embedded files (as printed by options.listEmbedded ). By default, the files are saved in the current directory; this can be changed with options.outputPath . |
[options.saveFile] | string |
Save the specified embedded file. By default, this uses the file name associated with the embedded file (as printed by options.listEmbedded ); the file name can be changed with options.outputPath . |
[options.saveSpecificFile] | number |
Save the specified embedded file. By default, this uses the file name associated with the embedded file (as printed by options.listEmbedded ); the file name can be changed with options.outputPath . |
[options.userPassword] | string |
User password (for encrypted files). |
Lists the fonts used in a PDF file along with various information for each font.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[options] | object |
Object containing options to pass to binary. |
[options.firstPageToExamine] | number |
Specifies the first page to examine. |
[options.lastPageToExamine] | number |
Specifies the last page to examine. |
[options.listSubstitutes] | boolean |
List the substitute fonts that poppler will use for non-embedded fonts. |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.userPassword] | string |
User password (for encrypted files). * |
Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
outputPrefix | string |
Filename prefix of output files. |
[options] | object |
Object containing options to pass to binary. |
[options.allFiles] | boolean |
Write JPEG, JPEG2000, JBIG2, and CCITT images in their native format. CMYK files are written as TIFF files. All other images are written as PNG files. |
[options.ccittFile] | boolean |
Generate CCITT images as CCITT files. |
[options.firstPageToConvert] | number |
Specifies the first page to convert. |
[options.lastPageToConvert] | number |
Specifies the last page to convert. |
[options.list] | boolean |
Instead of writing the images, list the images along with various information for each image. NOTE: Do not specify the outputPrefix with this option. |
[options.jbig2File] | boolean |
Generate JBIG2 images as JBIG2 files. |
[options.jpeg2000File] | boolean |
Generate JPEG2000 images at JP2 files. |
[options.jpegFile] | boolean |
Generate JPEG images as JPEG files. |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.pngFile] | boolean |
Change the default output format to PNG. |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.tiffFile] | boolean |
Change the default output format to TIFF. |
[options.userPassword] | string |
Specify the user password for the PDF file. |
Prints the contents of the Info
dictionary from a PDF file.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[options] | object |
Object containing options to pass to binary. |
[options.firstPageToConvert] | number |
First page to print. |
[options.lastPageToConvert] | number |
Last page to print. |
[options.listEncodingOptions] | boolean |
List the available encodings. |
[options.outputEncoding] | string |
Sets the encoding to use for text output. This defaults to UTF-8 . |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.printBoundingBoxes] | boolean |
Prints the page box bounding boxes: MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. |
[options.printDocStruct] | boolean |
Prints the logical document structure of a Tagged-PDF file. |
[options.printDocStructText] | boolean |
Print the textual content along with the document structure of a Tagged-PDF file. Note that extracting text this way might be slow for big PDF files. |
[options.printIsoDates] | boolean |
Prints dates in ISO-8601 format (including the time zone). |
[options.printJS] | boolean |
Prints all JavaScript in the PDF file. |
[options.printMetadata] | boolean |
Prints document-level metadata. (This is the Metadata stream from the PDF file's Catalog object). |
[options.printNamedDests] | boolean |
Print a list of all named destinations. If a page range is specified using the options.firstPageToConvert and options.lastPageToConvert options, only destinations in the page range are listed. |
[options.printRawDates] | boolean |
Prints the raw (undecoded) date strings, directly from the PDF file. |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.userPassword] | string |
User password (for encrypted files). |
Extract single pages from a PDF file, and writes one PDF file for each page to outputPattern. This will not work if the file is encrypted.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
outputPattern | string |
Should contain %d (or any variant respecting printf format), since %d is replaced by the page number. As an example, sample-%d.pdf will produce sample-1.pdf for a single page document. |
[options] | object |
Object containing options to pass to binary. |
[options.firstPageToExtract] | number |
Specifies the first page to extract. This defaults to page 1. |
[options.lastPageToExtract] | number |
Specifies the last page to extract. This defaults to the last page of the PDF file. |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
Converts a PDF file to PNG/JPEG/TIFF/PDF/PS/EPS/SVG.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[outputFile] | string |
Filepath of the file to output the results to. If undefined then will write output to stdout. Using stdout is not valid with image formats unless options.singleFile is set to true . If not set then the output filename will be derived from the PDF file name. |
[options] | object |
Object containing options to pass to binary. |
[options.antialias] | 'default' | 'none' | 'gray' | 'subpixel' | 'fast' | 'good' | 'best' |
Set the cairo antialias option used for text and drawing in image files (or rasterized regions in vector output). |
[options.cropBox] | boolean |
Uses the crop box rather than media box when generating the files (PNG/JPEG/TIFF only). |
[options.cropHeight] | number |
Specifies the height of crop area in pixels (image output) or points (vector output). |
[options.cropSize] | number |
Specifies the size of crop square in pixels (image output) or points (vector output). |
[options.cropWidth] | number |
Specifies the width of crop area in pixels (image output) or points (vector output). |
[options.cropXAxis] | number |
Specifies the x-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.cropYAxis] | number |
Specifies the y-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.duplex] | boolean |
Adds the %%IncludeFeature: *Duplex DuplexNoTumble DSC comment to the PostScript file (PS only). This tells the print manager to enable duplexing. |
[options.epsFile] | boolean |
Generate an EPS file. An EPS file contains a single image, so if you use this option with a multi-page PDF file, you must use options.firstPageToConvert and options.lastPageToConvert to specify a single page. The page size options (originalPageSizes, paperSize, paperWidth, paperHeight) can not be used with this option. |
[options.evenPagesOnly] | boolean |
Generates only the even numbered pages. |
[options.fillPage] | boolean |
Expand PDF pages smaller than the paper to fill the paper (PS,PDF,SVG only). By default, these pages are not scaled. |
[options.firstPageToConvert] | number |
Specifies the first page to convert. |
[options.grayscaleFile] | boolean |
Generate grayscale file (PNG, JPEG, and TIFF only). |
[options.iccFile] | string |
Use the specified ICC file as the output profile (PNG only). The profile will be embedded in the PNG file. |
[options.jpegFile] | boolean |
Generate JPEG file(s). |
[options.jpegOptions] | string |
When used with options.jpegFile , this option can be used to control the JPEG compression parameters. It takes a string of the form "<opt>=<val>[,<opt>=<val>]" . Currently available options are: * quality Selects the JPEG quality value. The value must be an integer between 0 and 100. * progressive Select progressive JPEG output. The possible values are "y", "n", indicating progressive (yes) or non-progressive (no), respectively. * optimize Sets whether to compute optimal Huffman coding tables for the JPEG output, which will create smaller files but make an extra pass over the data. The value must be "y" or "n", with "y" performing optimization, otherwise the default Huffman tables are used. Example: "quality=95,optimize=y" . |
[options.lastPageToConvert] | number |
Specifies the last page to convert. |
[options.monochromeFile] | boolean |
Generate monochrome file (PNG and TIFF only). |
[options.noCenter] | boolean |
By default, PDF pages smaller than the paper (after any scaling) are centered on the paper. This option causes them to be aligned to the lower-left corner of the paper instead (PS,PDF,SVG only). |
[options.noCrop] | boolean |
By default, printing output is cropped to the CropBox specified in the PDF file. This option disables cropping (PS, PDF, SVG only). |
[options.noShrink] | boolean |
Do not scale PDF pages which are larger than the paper (PS,PDF,SVG only). By default, pages larger than the paper are shrunk to fit. |
[options.oddPagesOnly] | boolean |
Generates only the odd numbered pages. |
[options.originalPageSizes] | boolean |
Set the paper size of each page to match the size specified in the PDF file. |
[options.ownerPassword] | string |
Specify the owner password for the PDF file. Providing this will bypass all security restrictions. |
[options.paperHeight] | number |
Set the paper height, in points (PS, PDF, SVG only). |
[options.paperSize] | 'letter' | 'legal' | 'A4' | 'A3' | 'match' |
Set the paper size to one of letter , legal , A4 , or A3 (PS,PDF,SVG only). This can also be set to match , which will set the paper size of each page to match the size specified in the PDF file. If none of the paperSize, paperWidth, or paperHeight options are specified the default is to match the paper size. |
[options.paperWidth] | number |
Set the paper width, in points (PS,PDF,SVG only). |
[options.pdfFile] | boolean |
Generate PDF file. |
[options.pngFile] | boolean |
Generate PNG file(s). |
[options.printVersionInfo] | boolean |
Print copyright and version information. |
[options.psFile] | boolean |
Generate PS file. |
[options.psLevel2] | boolean |
Generate Level 2 PostScript (PS only). |
[options.psLevel3] | boolean |
Generate Level 3 PostScript (PS only). This enables all Level 2 features plus shading patterns and masked images. This is the default setting. |
[options.quiet] | boolean |
Do not print any messages or errors. |
[options.resolutionXAxis] | number |
Specifies the X resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.resolutionXYAxis] | number |
Specifies the X and Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.resolutionYAxis] | number |
Specifies the Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.scalePageTo] | number |
Scales the long side of each page (width for landscape pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will be determined by the aspect ratio of the page (PNG/JPEG/TIFF only). |
[options.scalePageToXAxis] | number |
Scales each page horizontally to fit in scale-to-x pixels. If scale-to-y is set to -1, the vertical size will determined by the aspect ratio of the page (PNG/JPEG/TIFF only). |
[options.scalePageToYAxis] | number |
Scales each page vertically to fit in scale-to-y pixels. If scale-to-x is set to -1, the horizontal size will determined by the aspect ratio of the page (PNG/JPEG/TIFF only). |
[options.singleFile] | boolean |
Writes only the first page and does not add digits. |
[options.svgFile] | boolean |
Generate SVG (Scalable Vector Graphics) file. |
[options.tiffCompression] | 'none' | 'packbits' | 'jpeg' | 'lzw' | 'deflate' |
Set TIFF compression. |
[options.tiffFile] | boolean |
Generate TIFF file(s). |
[options.transparentPageColor] | boolean |
Use a transparent page color instead of white (PNG and TIFF only). |
[options.userPassword] | string |
Specify the user password for the PDF file. |
Converts a PDF file to HTML.
Poppler will use the directory and name of the original file
and append -html
to the end of the filename.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[options] | object |
Object containing options to pass to binary. |
[options.complexOutput] | boolean |
Generate complex output. |
[options.dataUrls] | boolean |
Use data URLs instead of external images in HTML. |
[options.exchangePdfLinks] | boolean |
Exchange .pdf links with .html. |
[options.extractHidden] | boolean |
Force hidden text extraction. |
[options.firstPageToConvert] | number |
First page to print. |
[options.fontFullName] | boolean |
Outputs the font name without any substitutions. |
[options.ignoreImages] | boolean |
Ignore images. |
[options.imageFormat] | 'PNG' | 'JPG' |
Image file format for Splash output (PNG or JPG). If complexOutput is selected, but imageFormat is not specified, PNG will be assumed. |
[options.lastPageToConvert] | number |
Last page to print. |
[options.noDrm] | boolean |
Override document DRM settings. |
[options.noFrames] | boolean |
Generate no frames. Not supported in complex output mode. |
[options.noMergeParagraph] | boolean |
Do not merge paragraphs. |
[options.noRoundedCoordinates] | boolean |
Do not round coordinates (with XML output only). |
[options.outputEncoding] | string |
Sets the encoding to use for text output. This defaults to UTF-8 . |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.printVersionInfo] | boolean |
Print copyright and version info. |
[options.quiet] | boolean |
Do not print any messages or errors. |
[options.singlePage] | boolean |
generate single HTML that includes all pages. |
[options.stdout] | boolean |
Use standard output. |
[options.userPassword] | string |
User password (for encrypted files). |
[options.wordBreakThreshold] | number |
Adjust the word break threshold percent. Default is 10. Word break occurs when distance between two adjacent characters is greater than this percent of character height. |
[options.xmlOutput] | boolean |
Output for XML post-processing. |
[options.zoom] | number |
Zoom the PDF document (default 1.5). |
Converts a PDF file to colour image files in Portable Pixmap (PPM) format, grayscale image files in Portable Graymap (PGM) format, or monochrome image files in Portable Bitmap (PBM) format.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
outputPath | string |
Filepath to output the results to. |
[options] | object |
Object containing options to pass to binary. |
[options.antialiasFonts] | 'yes' | 'no' |
Enable or disable font anti-aliasing. This defaults to yes . |
[options.antialiasVectors] | 'yes' | 'no' |
Enable or disable vector anti-aliasing. This defaults to yes . |
[options.cropBox] | boolean |
Uses the crop box rather than media box when generating the files (PNG/JPEG/TIFF only). |
[options.cropHeight] | number |
Specifies the height of crop area in pixels (image output) or points (vector output). |
[options.cropSize] | number |
Specifies the size of crop square in pixels (image output) or points (vector output). |
[options.cropWidth] | number |
Specifies the width of crop area in pixels (image output) or points (vector output). |
[options.cropXAxis] | number |
Specifies the x-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.cropYAxis] | number |
Specifies the y-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.defaultCmykProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultCMYK color space to the ICC profile stored in the display profile file passed. |
[options.defaultGrayProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultGray color space to the ICC profile stored in the display profile file passed. |
[options.defaultRgbProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultRGB color space to the ICC profile stored in the display profile file passed. |
[options.displayProfile] | string |
If Poppler is compiled with colour management support, this option sets the display profile to the ICC profile stored in the display profile file passed. |
[options.evenPagesOnly] | boolean |
Generates only the even numbered pages. |
[options.firstPageToConvert] | number |
Specifies the first page to convert. |
[options.freetype] | 'yes' | 'no' |
Enable or disable FreeType (a TrueType / Type 1 font rasterizer). This defaults to yes . |
[options.forcePageNumber] | boolean |
Force page number even if there is only one page. |
[options.grayscaleFile] | boolean |
Generate grayscale PGM file (instead of a color PPM file). |
[options.hideAnnotations] | boolean |
Hide annotations. |
[options.jpegFile] | boolean |
Generate JPEG file instead a PPM file. |
[options.lastPageToConvert] | number |
Specifies the last page to convert. |
[options.monochromeFile] | boolean |
Generate monochrome PBM file (instead of a color PPM file). |
[options.oddPagesOnly] | boolean |
Generates only the odd numbered pages. |
[options.ownerPassword] | string |
Specify the owner password for the PDF file. Providing this will bypass all security restrictions. |
[options.pngFile] | boolean |
Generate PNG file instead a PPM file. |
[options.printProgress] | boolean |
Print progress info as each page is generated. Three space-separated fields are printed to STDERR: the number of the current page, the number of the last page that will be generated, and the path to the file written to. |
[options.printVersionInfo] | boolean |
Print copyright and version information. |
[options.quiet] | boolean |
Do not print any messages or errors. |
[options.resolutionXAxis] | number |
Specifies the X resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.resolutionXYAxis] | number |
Specifies the X and Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.resolutionYAxis] | number |
Specifies the Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 150 PPI. |
[options.scalePageTo] | number |
Scales the long side of each page (width for landscape pages, height for portrait pages) to fit in scale-to pixels. The size of the short side will be determined by the aspect ratio of the page. |
[options.scalePageToXAxis] | number |
Scales each page horizontally to fit in scale-to-x pixels. If scale-to-y is set to -1, the vertical size will determined by the aspect ratio of the page. |
[options.scalePageToYAxis] | number |
Scales each page vertically to fit in scale-to-y pixels. If scale-to-x is set to -1, the horizontal size will determined by the aspect ratio of the page. |
[options.separator] | string |
Specify single character separator between name and page number. |
[options.singleFile] | boolean |
Writes only the first page and does not add digits. |
[options.thinLineMode] | 'none' | 'solid' | 'shape' |
Specifies the thin line mode. This defaults to none . |
[options.tiffCompression] | 'none' | 'packbits' | 'jpeg' | 'lzw' | 'deflate' |
Set TIFF compression. |
[options.tiffFile] | boolean |
Generate TIFF file instead a PPM file. |
[options.userPassword] | string |
Specify the user password for the PDF file. |
Converts a PDF file to PostScript (PS).
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[outputFile] | string |
Filepath of the file to output the results to. If undefined then will write output to stdout. |
[options] | object |
Object containing options to pass to binary. |
[options.antialias] | 'yes' | 'no' |
Enable anti-aliasing on rasterization, accepts yes or no . |
[options.binary] | boolean |
Write binary data in Level 1 PostScript. By default, pdftops writes hex-encoded data in Level 1 PostScript. Binary data is non-standard in Level 1 PostScript but reduces the file size and can be useful when Level 1 PostScript is required only for its restricted use of PostScript operators. |
[options.defaultCmykProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultCMYK color space to the ICC profile stored in the display profile file passed. |
[options.defaultGrayProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultGray color space to the ICC profile stored in the display profile file passed. |
[options.defaultRgbProfile] | string |
If Poppler is compiled with colour management support, this option sets the DefaultRGB color space to the ICC profile stored in the display profile file passed. |
[options.duplex] | boolean |
Set the Duplex pagedevice entry in the PostScript file. This tells duplex-capable printers to enable duplexing. |
[options.epsFile] | boolean |
Generate an EPS file. An EPS file contains a single image, so if you use this option with a multi-page PDF file, you must use options.firstPageToConvert and options.lastPageToConvert to specify a single page. The page size options (originalPageSizes, paperSize, paperWidth, paperHeight) can not be used with this option. |
[options.fillPage] | boolean |
Expand PDF pages smaller than the paper to fill the paper. By default, these pages are not scaled. |
[options.firstPageToConvert] | number |
Specifies the first page to convert. |
[options.form] | number |
Generate PostScript form which can be imported by software that understands forms. A form contains a single page, so if you use this option with a multi-page PDF file, you must use options.firstPageToConvert and options.lastPageToConvert to specify a single page. The options.level1 option cannot be used with options.form . No more than one of the mode options (options.epsFile , options.form ) may be given. |
[options.lastPageToConvert] | number |
Specifies the last page to convert. |
[options.level1] | boolean |
Generate Level 1 PostScript. The resulting PostScript files will be significantly larger (if they contain images), but will print on Level 1 printers. This also converts all images to black and white. |
[options.level1Sep] | boolean |
Generate Level 1 separable PostScript. All colors are converted to CMYK. Images are written with separate stream data for the four components. |
[options.level2] | boolean |
Generate Level 2 PostScript. Level 2 supports color images and image compression. This is the default setting. |
[options.level2Sep] | boolean |
Generate Level 2 separable PostScript. All colors are converted to CMYK. The PostScript separation convention operators are used to handle custom (spot) colors. |
[options.level3] | boolean |
Generate Level 3 PostScript. This enables all Level 2 featuresplus CID font embedding. |
[options.level3Sep] | boolean |
Generate Level 3 separable PostScript. The separation handling is the same as for options.level2Sep . |
[options.noEmbedCIDFonts] | boolean |
By default, any CID PostScript fonts which are embedded in the PDF file are copied into the PostScript file. This option disables that embedding. No attempt is made to substitute for non-embedded CID PostScript fonts. |
[options.noEmbedCIDTrueTypeFonts] | boolean |
By default, any CID TrueType fonts which are embedded in the PDF file are copied into the PostScript file. This option disables that embedding. No attempt is made to substitute for non-embedded CID TrueType fonts. |
[options.noEmbedTrueTypeFonts] | boolean |
By default, any TrueType fonts which are embedded in the PDF file are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead. Embedded fonts make PostScript files larger, but may be necessary for readable output. Also, some PostScript interpreters do not have TrueType rasterizers. |
[options.noEmbedType1Fonts] | boolean |
By default, any Type 1 fonts which are embedded in the PDF file are copied into the PostScript file. This option causes pdfToPs to substitute base fonts instead. Embedded fonts make PostScript files larger, but may be necessary for readable output. |
[options.noCenter] | boolean |
By default, PDF pages smaller than the paper (after any scaling) are centered on the paper. This option causes them to be aligned to the lower-left corner of the paper instead. |
[options.noCrop] | boolean |
By default, printing output is cropped to the CropBox specified in the PDF file. This option disables cropping. |
[options.noShrink] | boolean |
Do not scale PDF pages which are larger than the paper. By default, pages larger than the paper are shrunk to fit. |
[options.opi] | boolean |
Generate OPI comments for all images and forms which have OPI information. |
[options.optimizecolorspace] | boolean |
By default, bitmap images in the PDF pass through to the output PostScript in their original color space, which produces predictable results. This option converts RGB and CMYK images into Gray images if every pixel of the image has equal components. This can fix problems when doing color separations of PDFs that contain embedded black and white images encoded as RGB. |
[options.originalPageSizes] | boolean |
Set the paper size of each page to match the size specified in the PDF file. |
[options.overprint] | boolean |
Enable overprinting. |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.paperHeight] | number |
Set the paper height, in points. |
[options.paperSize] | 'letter' | 'legal' | 'A4' | 'A3' | 'match' |
Set the paper size to one of letter , legal , A4 , or A3 . This can also be set to match , which will set the paper size of each page to match the size specified in the PDF file. If none of the paperSize, paperWidth, or paperHeight options are specified the default is to match the paper size. |
[options.paperWidth] | number |
Set the paper width, in points. |
[options.passfonts] | boolean |
By default, references to non-embedded 8-bit fonts in the PDF file are substituted with the closest Helvetica , Times-Roman , or Courier font. This option passes references to non-embedded fonts through to the PostScript file. |
[options.preload] | boolean |
Preload images and forms. |
[options.printVersionInfo] | boolean |
Print copyright and version information. |
[options.processColorFormat] | 'CMYK8' | 'MONO8' | 'RGB8' |
Sets the process color format as it is used during rasterization and transparency reduction. The default depends on the other settings: For options.level1 the default is MONO8; for options.level1Sep , options.level2Sep , options.level3Sep , or options.overprint the default is CMYK8; in all other cases RGB8 is the default. If option.processColorProfile is set then options.processColorFormat is inferred from the specified ICC profile. |
[options.processColorProfile] | string |
Sets the ICC profile that is assumed during rasterization and transparency reduction. |
[options.quiet] | boolean |
Do not print any messages or errors. |
[options.rasterize] | 'always' | 'never' | 'whenneeded' |
By default, pdfToPs rasterizes pages as needed, for example, if they contain transparencies. To force rasterization, set rasterize to always . Use this to eliminate fonts. To prevent rasterization, set rasterize to never . This may produce files that display incorrectly. |
[options.resolutionXYAxis] | number |
Specifies the X and Y resolution, in pixels per inch of image files (or rasterized regions in vector output). The default is 300 PPI. |
[options.userPassword] | string |
User password (for encrypted files). |
Converts a PDF file to TXT.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
file | string |
Filepath of the PDF file to read. |
[outputFile] | string |
Filepath of the file to output the results to. If undefined then will write output to stdout. |
[options] | object |
Object containing options to pass to binary. |
[options.boundingBoxXhtml] | boolean |
Generate an XHTML file containing bounding box information for each word in the file. |
[options.boundingBoxXhtmlLayout] | boolean |
Generate an XHTML file containing bounding box information for each block, line, and word in the file. |
[options.cropBox] | boolean |
Use the crop box rather than the media box with options.boundingBoxXhtml and options.boundingBoxXhtmlLayout |
[options.cropHeight] | number |
Specifies the height of crop area in pixels (image output) or points (vector output). |
[options.cropWidth] | number |
Specifies the width of crop area in pixels (image output) or points (vector output). |
[options.cropXAxis] | number |
Specifies the x-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.cropYAxis] | number |
Specifies the y-coordinate of the crop area top left corner in pixels (image output) or points (vector output). |
[options.eolConvention] | 'unix' | 'dos' | 'mac' |
Sets the end-of-line convention to use for text output: unix; dos; mac. |
[options.firstPageToConvert] | number |
Specifies the first page to convert. |
[options.fixedWidthLayout] | number |
Assume fixed-pitch (or tabular) text, with the specified character width (in points). This forces physical layout mode. |
[options.generateHtmlMetaFile] | boolean |
Generate simple HTML file, including the meta information. This simply wraps the text in <pre> and </pre> and prepends the meta headers. |
[options.lastPageToConvert] | number |
Specifies the last page to convert. |
[options.listEncodingOptions] | boolean |
List the available encodings. |
[options.maintainLayout] | boolean |
Maintain (as best as possible) the original physical layout of the text. The default is to undo physical layout (columns, hyphenation, etc.) and output the text in reading order. |
[options.noDiagonalText] | boolean |
Discard diagonal text. |
[options.noPageBreaks] | boolean |
Do not insert page breaks (form feed characters) between pages. |
[options.outputEncoding] | string |
Sets the encoding to use for text output. This defaults to UTF-8 . |
[options.ownerPassword] | string |
Owner password (for encrypted files). |
[options.printVersionInfo] | boolean |
Print copyright and version information. |
[options.quiet] | boolean |
Do not print any messages or errors. |
[options.rawLayout] | boolean |
Keep the text in content stream order. This is a hack which often undoes column formatting, etc. Use of raw mode is no longer recommended. |
[options.userPassword] | string |
User password (for encrypted files). |
Merges several PDF files in order of their occurrence in the files array to one PDF result file.
Kind: instance method of Poppler
Returns: Promise.<(string|Error)>
- Promise of stdout string on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
files | Array |
Filepaths of the PDF files to merge. An entire directory of PDF files can be merged like so: path/to/directory/*.pdf . |
outputFile | string |
Filepath of the file to output the resulting merged PDF to. |
[options] | object |
Object containing options to pass to binary. |
[options.printVersionInfo] | boolean |
Print copyright and version information. |
Check each option provided is valid, of the correct type, and can be used by specified version of binary.
Kind: global function
Returns: Promise.<(Array|Error)>
- Promise of array of CLI arguments on resolve, or Error object on rejection.
Author: Frazer Smith
Param | Type | Description |
---|---|---|
acceptedOptions | object |
Object containing options that a binary accepts. |
options | object |
Object containing options to pass to binary. |
[version] | string |
Version of binary. |