Namespace: configs


Calls related to setting up new printer configurations.


(static) create(printer, optionsopt) → {Config}

Creates new printer config to be used in printing.
Name Type Attributes Description
printer string | object Name of printer. Use object type to specify printing to file or host.
Name Type Attributes Description
name string <optional>
Name of printer to send printing.
file string <optional>
Name of file to send printing.
host string <optional>
IP address or host name to send printing.
port string <optional>
Port used by <>.
options Object <optional>
Override any of the default options for this config only.
  • configs.setDefaults
The new config.

(static) setDefaults(options)

Default options used by new configs if not overridden. Setting a value to NULL will use the printer's default options. Updating these will not update the options on any created config.
Name Type Description
options Object Default options used by printer configs if not overridden.
Name Type Attributes Default Description
bounds Object <optional>
null Bounding box rectangle.
Name Type Attributes Default Description
x number <optional>
0 Distance from left for bounding box starting corner
y number <optional>
0 Distance from top for bounding box starting corner
width number <optional>
0 Width of bounding box
height number <optional>
0 Height of bounding box
colorType string <optional>
'color' Valid values [color | grayscale | blackwhite]
copies number <optional>
1 Number of copies to be printed.
density number | Array.<number> | Object | Array.<Object> | string <optional>
0 Pixel density (DPI, DPMM, or DPCM depending on [options.units]). If provided as an array, uses the first supported density found (or the first entry if none found). If provided as a string, valid values are [best | draft], corresponding to highest or lowest reported density respectively.
Name Type Attributes Default Description
cross number <optional>
0 Asymmetric pixel density for the cross feed direction.
feed number <optional>
0 Asymmetric pixel density for the feed direction.
duplex boolean | string <optional>
false Double sided printing, Can specify duplex style by passing a string value: [one-sided | duplex | long-edge | tumble | short-edge]
fallbackDensity number <optional>
null Value used when default density value cannot be read, or in cases where reported as "Normal" by the driver, (in DPI, DPMM, or DPCM depending on [options.units]).
interpolation string <optional>
'bicubic' Valid values [bicubic | bilinear | nearest-neighbor]. Controls how images are handled when resized.
jobName string <optional>
null Name to display in print queue.
legacy boolean <optional>
false If legacy style printing should be used.
margins Object | number <optional>
0 If just a number is provided, it is used as the margin for all sides.
Name Type Attributes Default Description
top number <optional>
right number <optional>
bottom number <optional>
left number <optional>
orientation string <optional>
null Valid values [portrait | landscape | reverse-landscape]
paperThickness number <optional>
printerTray string | number <optional>
null Printer tray to pull from. The number N assumes string equivalent of 'Tray N'. Uses printer default if NULL.
rasterize boolean <optional>
false Whether documents should be rasterized before printing. Specifying [options.density] for PDF print formats will set this to true.
rotation number <optional>
0 Image rotation in degrees.
scaleContent boolean <optional>
true Scales print content to page size, keeping ratio.
size Object <optional>
null Paper size.
Name Type Attributes Default Description
width number <optional>
null Page width.
height number <optional>
null Page height.
units string <optional>
'in' Page units, applies to paper size, margins, and density. Valid value [in | cm | mm]
altPrinting boolean <optional>
false Print the specified file using CUPS command line arguments. Has no effect on Windows.
encoding string <optional>
null Character set
endOfDoc string <optional>
perSpool number <optional>
1 Number of pages per spool.