Please enable JavaScript to view this site.

InterFormNG2 Manual

Navigation: Settings > APIs

APIs for printers

Scroll Prev Top Next More

Below you see a list of the APIs for printers in InterFormNG2. APIs are introduced here.

 

List system printer names

This returns a list with the names of all printers that are installed on the O/S on the InterFormNG2 host machine.

 

GET <NG2_URL>/restapi/v1/systemPrinters

 

Input: N/A

 

JSON example output:

 

{

"systemPrinterNames": [

  "OneNote (Desktop)",

  "ZDesigner ZD500R-203dpi ZPL",

  "OneNote for Windows 10",

  "Microsoft XPS Document Writer",

  "Microsoft Print to PDF",

  "HPLJ500C (HP LaserJet 500 color M551)",

  "Fax"

]

}

 

List configured printers

This returns a list of all the printers that have been configured in the InterFormNG2 settings.

 

GET <NG2_URL>/restapi/v1/printers

 

Input: N/A

 

JSON example output:

 

{

"printers": [

  {

    "type": "system",

    "id": "InterForm",

    "dpi": 300,

    "mimeType": "application/vnd.hp-PCL",

    "remoteOutput": false,

    "systemPrinterName": "HP 500-2"

  },

  {

    "type": "socket",

    "id": "PDF Printer",

    "dpi": 300,

    "mimeType": "application/pdf",

    "remoteOutput": false,

    "printerAddress": "localhost"

  },

  {

    "type": "system",

    "id": "ZDesigner",

    "dpi": 300,

    "mimeType": "x-application/zpl",

    "remoteOutput": false,

    "systemPrinterName": "ZDesigner ZD500R-203dpi ZPL"

  }

]

}

 

id is the unique id of the printer configuration entry. This field matches "name" in the settings UI. Note that the same physical printer can have multiple configuration entries.

type indicates the printer configuration type.

mimeType is the document type that the printer accepts (as generated by an InterFormNG2 workflow).

 

 

Get printer details

Some printers have advanced settings that are not part of the output in the list above. This request will return all settings values for a specific printer id.

 

GET <NG2_URL>/restapi/v1/printers/<id>

 

Input: <id> in the URL must be replaced with the id of the specific printer (as seen in the list above).

 

JSON example output:

 

{

"printer": {

  "type": "system",

  "id": "ZDesigner",

  "dpi": 300,

  "mimeType": "x-application/zpl",

  "remoteOutput": false,

  "advanced": {

    "ct": "~",

    "cc": "^",

    "cd": ",",

    "startWithFonts": true

  },

  "systemPrinterName": "ZDesigner ZD500R-203dpi ZPL"

}

}

 

Typical HTTP error codes:

 

   404: The requested id was not found

 

 

Add new printer configuration

POST <NG2_URL>/restapi/v1/printers/

 

Input: The body of the request must be the printer configuration to add, including the desired id.

The following input fields are available. Some are only relevant for a specific printer type:

Field

Printer type

Data type

Description

type

all

string (mandatory)

The type of printer configuration. Valid values: system, socket, ipp, lpd, preview

id

all

string (mandatory)

The unique id (name) of the new printer configuration entry. Must be different from existing ids.

dpi

all

integer (mandatory)

The DPI of the printer.

mimeType

all

string (mandatory)

The document type that the printer exists. Valid values: application/vnd.hp-PCL, x-application/zpl, x-application/direct-protocol, application/javaprint, application/pdf.

remoteOutput

all

boolean

If the printer is connected via a remote output client.

remoteLocation

all

string

If remote output is "true", then this must be the location id of the remote output client.

advanced

all

object

Advanced settings for the specific mime type (see below)

systemPrinterName

system

string

The name of the printer on the O/S (as listed by "list system printers name" unless it is on a remote output client)

outputQueue

system

string

For IBM i installations only, the output queue of the printer.

outputLib

system

string

For IBM i installations only, the output queue library of the printer.

uri

ipp

string

URI of the printer

username

ipp

string

User name to use when connecting to the printer

password

ipp

string

Password to use when connecting to the printer

printerAddress

socket, lpd, preview

string

The IP address of the printer.

shareName

lpd

string

The share name of the printer

port

preview

integer

The network port of the preview printer

 

The advanced object can have the following fields. Each mimeType has its own set of valid fields.

 

Field

Mime type

Data type

Description

pclCommands

application/vnd.hp-PCL

string

Additional PCL commands to add in the beginning of the PCL document.

pjlCommands

application/vnd.hp-PCL

string

Additional PJL commands to add in the beginning of the PJL document.













































 

pclCommands        application/vnd.hp-PCL        string        Additional PCL commands to add in the beginning of the PCL document.

pjlCommands        application/vnd.hp-PCL        string        Additional PJL commands to add in the beginning of the PJL document.

includeStandardFonts        application/vnd.hp-PCL        boolean        Set true if standard fonts should be sent to the printer with the print job.

fillUsingRaster        application/vnd.hp-PCL        boolean        Set true if InterFormNG2 should convert grayscale to black&white instead of letting the printer do it.

fullColor        application/vnd.hp-PCL        boolean        Set true to print in color, false for black&white.

compressColorImages        application/vnd.hp-PCL        boolean        True to compress color images with run-length compression. Only relevant when fullColor = true

ct        x-application/zpl        string (1)        The character to use as ct in ZPL

cc        x-application/zpl        string (1)        The character to use as cc in ZPL

cd        x-application/zpl        string (1)        The character to use as cd in ZPL

startWithFonts        x-application/zpl        boolean        Include fonts definition on each page.

fonts        x-application/direct-protocol        string[]        Array of font names for fonts already installed on the printer

images        x-application/direct-protocol        string[]        Array of image names for images already installed on the printer

 

 

JSON example input:

 

{

 "type": "ipp",

 "id": "NewIPP",

 "dpi": 300,

 "mimeType": "application/vnd.hp-PCL",

 "remoteOutput": false,

 "advanced": {

   "fullColor": true,

   "compressColorImages": true

 },

 "uri": "192.192.100.100",

 "username": "Default",

 "password": "password"

}

 

Output: In case of successful operation, no response body is returned. In case of error, the standard error body is returned.

 

Typical HTTP error codes:

 

   403: The requested id already exists