Printer information

Integrating via

Available from version

When printing your own texts on a receipt, for example columns with a name and a price, you need to know how many characters fit on one line. This value can differ from the value in the eKasa settings; the reasons are explained below.

The application settings store what the user chose; the info endpoint shows what printing actually follows. So if your application sends optional texts for the receipt, or prints non-fiscal receipts, and your print output depends on the maximum number of characters per line, we recommend loading the printer information before composing your own texts. The value from the settings may not be enough.

Getting printer information

GET {server_address}/api/v1/printers/pos/info
PrinterInfo printerInfo = await client.GetPrinterInfoAsync(PrinterName.Pos, cancellationToken);

Example response:

{
  "connection": "Internal",
  "text": {
    "layout": "Monospace",
    "charactersPerLine": 42
  }
}

Why the values differ from the settings

The values in the settings may differ from the printer properties actually used when the application runs on an Android device with a built-in printer and prints on that built-in printer. Built-in printers have a fixed line width, so the application prefers its own value to the application settings.

Some examples of these values by device model:

manufacturer model characters per line
Sunmi P3 MIX with an 80 mm printer 48
Sunmi P3 MIX with a 58 mm printer 32
Sunmi D3 mini with an 80 mm printer 48
Sunmi D3 mini with a 58 mm printer 32
Sunmi D3 48
Sunmi V3, P2-EU, P3h Dual 32
Ingenico DX4000, DX8000 27 or 38 depending on the font
PAX A920 Pro 32

So on a Sunmi P3h Dual, the settings may contain a different value (the default 42 characters or another), but the receipt is printed at 32 characters.

On Sunmi devices, the number of characters per line is read directly from the built-in printer based on the paper width: a 58 mm printer (384 dots) gives 32 characters, an 80 mm printer (576 dots) 48 characters. The device model does not reliably determine the width. For example, the Sunmi P3 MIX and D3 mini are sold in both 58 mm and 80 mm versions, and both versions report the same model name. The value by model is used only when the printer does not report its width (for example right after the device starts) or reports a width the application does not know.

With automatic printer selection, the values change at runtime. If automatic switching between the internal and an external USB printer is turned on in the settings, printing goes to the external printer whenever it is connected. The external printer may have a different line width from the built-in printer. Connecting or disconnecting the external printer therefore changes the effective number of characters per line, even without any change to the application settings.

The connection property

How the printer is connected. Unlike the setting of the same name, it never means “choose automatically”: the choice has already been made at this point.

Value Description
Internal The device’s built-in printer, or a printer connected to the protected data storage.
Usb An external printer connected to the device via USB.
null A printer this distinction does not apply to, for example when issuing an e-receipt.

The text property

Describes the text the printer produces. The value null means the printer does not produce text.

text.layout

Value Description
Monospace Monospaced font: every character has the same width, so a line can be composed by counting characters.
Proportional Proportional font: the character width depends on the character itself, so the number of characters per line is not defined and the printer wraps the text.

text.charactersPerLine

The number of characters per line that printing actually follows, after taking into account the paper width of the built-in printer or adjustments by device model. It is present exactly when layout is Monospace; with a proportional (Proportional) font it is null.

A missing text and a missing charactersPerLine do not mean the same thing. The first says that nothing is printed; the second that text is printed, but cannot be composed by counting characters.

Examples by situation

An external USB printer with a monospaced font:

{
  "connection": "Usb",
  "text": {
    "layout": "Monospace",
    "charactersPerLine": 42
  }
}

The built-in printer of a Sunmi P3h Dual: the settings report 42, printing uses 32:

{
  "connection": "Internal",
  "text": {
    "layout": "Monospace",
    "charactersPerLine": 32
  }
}

An e-receipt, to which the connection type does not apply:

{
  "connection": null,
  "text": {
    "layout": "Monospace",
    "charactersPerLine": 42
  }
}

A device without a supported printer (nothing is produced):

{
  "connection": "Internal",
  "text": null
}

Printer names

The printer name ({printerName} in the path /api/v1/printers/{printerName}/info) is required, because the response differs for each printer.

Name Description
pos The paper receipt printer.
pdf Issuing an e-receipt as a PDF file.
email Issuing an e-receipt as an email message with an attachment.

An invalid name results in a 400 response.

Esc

↑↓ selectEnter openEsc close

Chýba vám niečo v dokumentácii?

Napíšte nám, s čím potrebujete pomôcť. Ozveme sa do pár hodín.

Údaje použijeme len na odpoveď. Viac v ochrane osobných údajov.