2015-12-27 15:56:51 +00:00
***** **
Methods
***** **
2016-01-05 16:30:40 +00:00
.. note :: **TODO** Merge this page with the API-description. (Make the API-description more pretty and then
replace this with the API-description.)
2015-12-27 15:56:51 +00:00
Escpos class
------------
2016-12-09 15:42:23 +00:00
Escpos inherits its methods to the printers. The following methods are
2015-12-27 15:56:51 +00:00
defined:
image("image\_name.ext")
^^^^^^^^^^^^^^^^^^^^^^^^
2016-12-09 15:42:23 +00:00
Prints an image. It adjusts the size in order to print it.
2015-12-27 15:56:51 +00:00
* `` image_name.ext `` is the complete file name and location of any image type (jpg, gif, png, bmp)
Raises `` ImageSizeError `` exception.
qr("text")
^^^^^^^^^^
Prints a QR code. The size has been adjusted to Version 4, so it can be
enough small to be printed but also enough big to be read by a smart
phone.
* `` text `` Any text that needs to be QR encoded. It could be a slogan,
salutation, url, etc.
barcode("code", "barcode\_type", width, height, "position", "font")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Prints a barcode.
* `` code `` is an alphanumeric code to be printed as bar code
2016-03-07 04:25:16 +00:00
* `` barcode_type `` must be one of the following type of codes for function type A:
2015-12-27 15:56:51 +00:00
* UPC-A
* UPC-E
* EAN13
* EAN8
* CODE39
* ITF
* NW7
2016-03-07 04:25:16 +00:00
And for function type B:
* Any type above
* CODE93
* CODE128
* GS1-128
* GS1 DataBar Omnidirectional
* GS1 DataBar Truncated
* GS1 DataBar Limited
* GS1 DataBar Expanded
2015-12-27 15:56:51 +00:00
* `` width `` is a numeric value in the range between (1,255) *Default:* 64
* `` height `` is a numeric value in the range between (2,6) *Default:* 3
* `` position `` is where to place the code around the bars, could be one of the following values:
* ABOVE
* BELOW
* BOTH
* OFF > *Default:* BELOW
* `` font `` is one of the 2 type of fonts, values could be:
* A
2016-03-07 04:25:16 +00:00
* B > *Default:* A
2016-12-09 15:42:23 +00:00
* `` function_type `` chooses between ESCPOS function type A or B. A is default, B has more barcode options. Choose which one based upon your printer support and required barcode.
2016-03-07 04:25:16 +00:00
* A
* B > *Default* A
* Raises `` BarcodeTypeError `` , `` BarcodeSizeError `` , `` BarcodeCodeError `` exceptions.
2015-12-27 15:56:51 +00:00
text("text")
^^^^^^^^^^^^
Prints raw text. Raises `` TextError `` exception.
2016-09-01 10:57:58 +00:00
set("align", "font", "text_type", width, height, invert, smooth, flip)
2016-09-01 11:10:35 +00:00
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2015-12-27 15:56:51 +00:00
Set text properties.
2016-08-02 02:38:04 +00:00
2015-12-27 15:56:51 +00:00
* `` align `` set horizontal position for text, the possible values are:
* CENTER
* LEFT
* RIGHT > > *Default:* left
* `` font `` type could be `` A `` or `` B `` . *Default:* A
2016-09-01 10:57:58 +00:00
* `` text_type `` type could be `` B `` (Bold), `` U `` (Underline) or `` normal `` . *Default:* normal
2015-12-27 15:56:51 +00:00
* `` width `` is a numeric value, 1 is for regular size, and 2 is twice the standard size. *Default* : 1
* `` height `` is a numeric value, 1 is for regular size and 2 is twice the standard size. *Default* : 1
2016-02-29 18:04:00 +00:00
* `` invert `` is a boolean value, True enables white on black printing. *Default* : False
2016-03-01 18:05:52 +00:00
* `` smooth `` is a boolean value, True enables text smoothing. *Default* : False
* `` flip `` is a boolean value, True enables upside-down text. *Default* : False
2015-12-27 15:56:51 +00:00
cut("mode")
^^^^^^^^^^^
Cut paper.
2016-08-02 02:38:04 +00:00
2015-12-27 15:56:51 +00:00
* `` mode `` set a full or partial cut. *Default:* full
**Partial cut is not implemented in all printers.**
cashdraw(pin)
^^^^^^^^^^^^^
2016-12-09 15:42:23 +00:00
Sends a pulse to the cash drawer on the specified pin.
2015-12-27 15:56:51 +00:00
* `` pin `` is a numeric value which defines the pin to be used to send the pulse, it could be 2 or 5. Raises `` CashDrawerError() ``
hw("operation")
^^^^^^^^^^^^^^^
Hardware operations.
* `` operation `` is any of the following options:
* INIT
* SELECT
* RESET
control("align")
^^^^^^^^^^^^^^^^
Carrier feed and tabs.
2016-08-02 02:38:04 +00:00
2015-12-27 15:56:51 +00:00
* `` align `` is a string which takes any of the following values:
* LF *for Line Feed*
* FF *for Form Feed*
* CR *for Carriage Return*
* HT *for Horizontal Tab*
* VT *for Vertical Tab*