Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.datecs.api.printer
Class Printer

    java.lang.Object
      com.datecs.api.printer.Printer

    public class Printer

extends java.lang.Object

This class implements support for Datecs's ESC/P printers.

This class implements methods for control printers with extended version of the Datecs's ESC/P control language. For data transmit it use instances `InputStream` and `OutputStream` classes. The `InputStream` instance must provide a proper implementation of `InputStream.available()` method.

If the printer is set to work in "Protocol mode" then the protocol data encapsulation must be handled through an instance of `ProtocolAdapter` , using `ProtocolAdapter.CHANNEL_PRINTER` logical channel socket.

All methods are internally synchronized with instance of current object.

Nested Class Summary
`static interface` | `Printer.ConnectionListener` Interface definition for a Printer event callback.

Field Summary
`static int` | `ALIGN_CENTER` The printing object is centered.
`static int` | `ALIGN_LEFT` The printing object is left aligned.
`static int` | `ALIGN_RIGHT` The printing object is left aligned.
`static int` | `BARCODE_CODABAR` CODABAR (NW-7) barcode type.
`static int` | `BARCODE_CODE128` CODE 128 barcode type.
`static int` | `BARCODE_CODE128AUTO` CODE 128 Auto barcode type.
`static int` | `BARCODE_CODE39` CODE 39 barcode type.
`static int` | `BARCODE_CODE93` CODE 93 barcode type.
`static int` | `BARCODE_EAN128` EAN 128 barcode type.
`static int` | `BARCODE_EAN13` EAN13 (JAN13) barcode type.
`static int` | `BARCODE_EAN8` EAN 8 (JAN8) barcode type.
`static int` | `BARCODE_ITF` ITF barcode type.
`static int` | `BARCODE_PDF417` PDF417 barcode type.
`static int` | `BARCODE_UPCA` UPC-A barcode type.
`static int` | `BARCODE_UPCE` UPC-E barcode type.
`static int` | `FILL_BLACK` The area is filled (black color).
`static int` | `FILL_INVERTED` The area is inverted.
`static int` | `FILL_WHITE` The area is cleared (white color).
`static int` | `HRI_ABOVE` The HRI code is drawn above the barcode.
`static int` | `HRI_BELOW` The HRI code is drawn below the barcode.
`static int` | `HRI_BOTH` The HRI code is drawn both above and below the barcode.
`static int` | `HRI_NONE` No HRI code is being drawn.
`static int` | `PAGE_BOTTOM` Printing from bottom to top, feed to right.
`static int` | `PAGE_LEFT` Printing page from left to right, feed to bottom.
`static int` | `PAGE_RIGHT` Printing page from right to left, feed to top.
`static int` | `PAGE_TOP` Printing page from top to bottom, feed to left.
`static int` | `SETTINGS_BLUETOOTH` Bluetooth settings.

Constructor Summary
`Printer(java.io.InputStream in, java.io.OutputStream out)` Constructs a new instance of this class from a given `InputStream` and `OutputStream`.
`Printer(java.io.OutputStream out)` Constructs a new instance of this class from a given `OutputStream`.

Method Summary
`void` | `beep()` Sounds the buzzer.
`void` | `calibrateBMMSensor()` Black mark mode sensor calibration.
`void` | `close()` Close the streams and release all associated resources.
`void` | `drawPageFrame(int x, int y, int width, int height, int fillMode, int thickness)` Draws a rectangle frame with selected thickness in page mode.
`void` | `drawPageRectangle(int x, int y, int width, int height, int fillMode)` Draws a rectangle in page mode.
`void` | `feedLabel()` Feed to the next label.
`void` | `feedPaper(int lines)` Feeds paper with specified lines number.
`void` | `flush()` Flushes the output stream and forces any buffered output bytes to be written out.
`PrinterInformation` | `getInformation()` Returns the printer information.
`java.lang.String[]` | `getSettings(int type)` Reading printer settings.
`int` | `getStatus()` Returns the printer status.
`int` | `getTemperature()` Returns the printer head temperature.
`TouchChip` | `getTouchChip()` Get instance of TouchChip module.
`int` | `getVoltage()` Returns the printer battery voltage.
`int` | `getVoltagePercentage()` Returns the printer battery level in percents.
`void` | `journalFormat()` Format journal
`void` | `journalPrint()` Print journal
`byte[]` | `journalRead()` Read journal
`java.lang.String` | `journalRead(java.lang.String charset)` Read journal
`void` | `journalWrite(byte[] data)` Write journal data.
`void` | `journalWrite(java.lang.String text, java.lang.String charset)` Write journal text.
`void` | `melody(java.lang.String data)` Making (beeping) a sequence of sounds with a certain frequency and duration.
`void` | `printArabicText(int codetable, java.lang.String text)` Print Arabic text.
`void` | `printBarcode(int type, byte[] data)` Prints a barcode.
`void` | `printBarcode(int type, java.lang.String data)` Prints a barcode.
`void` | `printCompressedImage(int[] argb, int width, int height, int align, boolean dither)`
`void` | `printCompressedImage(int[] argb, int width, int height, int align, boolean dither, boolean crop)`
`void` | `printImage(int[] argb, int width, int height, int align, boolean dither)`
`void` | `printImage(int[] argb, int width, int height, int align, boolean dither, boolean crop)`
`void` | `printLogo()` Prints a stored bit image (logo).
`void` | `printLogo(boolean wide, boolean high)` Prints a stored bit image (logo).
`void` | `printPage()` Prints the non blank page area only in page mode.
`void` | `printQRCode(int size, int eccLv, byte[] data)` Prints the QRCode.
`void` | `printQRCode(int size, int eccLv, java.lang.String data)` Prints the QRCode.
`void` | `printSelfTest()` Prints self test receipt.
`void` | `printTaggedText(java.lang.String s)` Prints a tagged text using default charset for encoding.
`void` | `printTaggedText(java.lang.String s, java.lang.String encoding)` Prints a tagged text using the named charset for encoding.
`void` | `printText(byte[] b)` Prints a text using default charset for encoding.
`void` | `printText(java.lang.String s)` Prints a text using default charset for encoding.
`void` | `printText(java.lang.String s, java.lang.String encoding)` Prints a text using the named charset for encoding.
`java.lang.String` | `readBarcode(int timeout)` Reads the barcode.
`java.lang.String[]` | `readCard(boolean first, boolean second, boolean third, int timeout)` Reads the magnetic stripe card.
`void` | `reset()` Resets printer to it's default settings.
`void` | `selectCodetable(int codetable)` Selects a code table.
`void` | `selectPageMode()` Switches from standard mode to page mode.
`void` | `selectStandardMode()` Switches from page mode to standard mode.
`void` | `setAlign(int align)` Sets alignment for the next printed text row or object.
`void` | `setBarcode(int align, boolean small, int scale, int hri, int height)` Sets the various barcode parameters.
`void` | `setConnectionListener(Printer.ConnectionListener listener)` Set a callback listener to notify the connection state is changed.
`static void` | `setDebug(boolean on)` Specify whether the object can output debug information
`void` | `setIntensity(int level)` Set intensity level.
`void` | `setLineSpace(int lines)` Sets the line space of text rows.
`void` | `setPageRegion(int x, int y, int width, int height, int direction)` Defines the relative position, size print direction of the page.
`void` | `setPageXY(int x, int y)` Sets the print position in current page region.
`void` | `turnOff()` Turn off printer.
`void` | `write(byte[] b)` Writes all bytes from the specified byte array to this printer.
`void` | `write(byte[] b, int offset, int length)` Writes `length` bytes from the specified byte array to this printer.
`void` | `write(int b)` Writes the specified byte to this printer.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ALIGN_LEFT

    public static final int ALIGN_LEFT

  The printing object is left aligned.

  See Also:
    Constant Field Values

### ALIGN_CENTER

    public static final int ALIGN_CENTER

  The printing object is centered.

  See Also:
    Constant Field Values

### ALIGN_RIGHT

    public static final int ALIGN_RIGHT

  The printing object is left aligned.

  See Also:
    Constant Field Values

### BARCODE_UPCA

    public static final int BARCODE_UPCA

  UPC-A barcode type.

  See Also:
    Constant Field Values

### BARCODE_UPCE

    public static final int BARCODE_UPCE

  UPC-E barcode type.

  See Also:
    Constant Field Values

### BARCODE_EAN13

    public static final int BARCODE_EAN13

  EAN13 (JAN13) barcode type.

  See Also:
    Constant Field Values

### BARCODE_EAN8

    public static final int BARCODE_EAN8

  EAN 8 (JAN8) barcode type.

  See Also:
    Constant Field Values

### BARCODE_CODE39

    public static final int BARCODE_CODE39

  CODE 39 barcode type.

  See Also:
    Constant Field Values

### BARCODE_ITF

    public static final int BARCODE_ITF

  ITF barcode type.

  See Also:
    Constant Field Values

### BARCODE_CODABAR

    public static final int BARCODE_CODABAR

  CODABAR (NW-7) barcode type.

  See Also:
    Constant Field Values

### BARCODE_CODE93

    public static final int BARCODE_CODE93

  CODE 93 barcode type.

  See Also:
    Constant Field Values

### BARCODE_CODE128

    public static final int BARCODE_CODE128

  CODE 128 barcode type.

  See Also:
    Constant Field Values

### BARCODE_PDF417

    public static final int BARCODE_PDF417

  PDF417 barcode type.

  See Also:
    Constant Field Values

### BARCODE_CODE128AUTO

    public static final int BARCODE_CODE128AUTO

  CODE 128 Auto barcode type.

  See Also:
    Constant Field Values

### BARCODE_EAN128

    public static final int BARCODE_EAN128

  EAN 128 barcode type.

  See Also:
    Constant Field Values

### HRI_NONE

    public static final int HRI_NONE

  No HRI code is being drawn.

  See Also:
    Constant Field Values

### HRI_ABOVE

    public static final int HRI_ABOVE

  The HRI code is drawn above the barcode.

  See Also:
    Constant Field Values

### HRI_BELOW

    public static final int HRI_BELOW

  The HRI code is drawn below the barcode.

  See Also:
    Constant Field Values

### HRI_BOTH

    public static final int HRI_BOTH

  The HRI code is drawn both above and below the barcode.

  See Also:
    Constant Field Values

### PAGE_LEFT

    public static final int PAGE_LEFT

  Printing page from left to right, feed to bottom. Starting point in left top corner of the page.

  See Also:
    Constant Field Values

### PAGE_BOTTOM

    public static final int PAGE_BOTTOM

  Printing from bottom to top, feed to right. Starting point in left bottom corner of the page.

  See Also:
    Constant Field Values

### PAGE_RIGHT

    public static final int PAGE_RIGHT

  Printing page from right to left, feed to top. Starting point in right bottom corner of the page.

  See Also:
    Constant Field Values

### PAGE_TOP

    public static final int PAGE_TOP

  Printing page from top to bottom, feed to left. Starting point in right top corner of the page.

  See Also:
    Constant Field Values

### FILL_WHITE

    public static final int FILL_WHITE

  The area is cleared (white color).

  See Also:
    Constant Field Values

### FILL_BLACK

    public static final int FILL_BLACK

  The area is filled (black color).

  See Also:
    Constant Field Values

### FILL_INVERTED

    public static final int FILL_INVERTED

  The area is inverted.

  See Also:
    Constant Field Values

### SETTINGS_BLUETOOTH

    public static final int SETTINGS_BLUETOOTH

  Bluetooth settings.

  See Also:
    Constant Field Values

Constructor Detail

### Printer

    public Printer(java.io.OutputStream out)
            throws java.io.IOException

  Constructs a new instance of this class from a given `OutputStream`.

  The `in` is set to `null`.

  If `out` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `out` - the output stream.
  Throws:
    `java.io.IOException`

### Printer

    public Printer(java.io.InputStream in,
                   java.io.OutputStream out)
            throws java.io.IOException

  Constructs a new instance of this class from a given `InputStream` and `OutputStream`.

  If `in` or `out` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `in` - the input stream.
    `out` - the output stream.
  Throws:
    `java.io.IOException`

Method Detail

### close

    public void close()

  Close the streams and release all associated resources.

### setDebug

    public static void setDebug(boolean on)

  Specify whether the object can output debug information

  Parameters:
    `on` - True to enable debbuging; otherwise false.

### write

    public void write(int b)
               throws java.io.IOException

  Writes the specified byte to this printer. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

  Parameters:
    `b` - the byte.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### write

    public void write(byte[] b)
               throws java.io.IOException

  Writes all bytes from the specified byte array to this printer.

  If `b` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `b` - the data.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `write(byte[], int, int)`

### write

    public void write(byte[] b,
                      int offset,
                      int length)
               throws java.io.IOException

  Writes `length` bytes from the specified byte array to this printer.

  If `b` is `null`, a `NullPointerException` is thrown.

  if `offset` is negative, or `length` is negative, or `offset + length` is greater than the length of the array `b`, then an `IndexOutOfBoundsException` is thrown.

  Parameters:
    `b` - the data.
    `offset` - the start offset in the data.
    `length` - the number of bytes to write.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### setConnectionListener

    public void setConnectionListener(Printer.ConnectionListener listener)

  Set a callback listener to notify the connection state is changed.

  Parameters:
    `listener` - the listener.

### flush

    public void flush()
               throws java.io.IOException

  Flushes the output stream and forces any buffered output bytes to be written out.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getInformation

    public PrinterInformation getInformation()
                                      throws java.io.IOException

  Returns the printer information.

  If `in` is `null`, a `NullPointerException` is thrown.

  Returns:
    an instance of `PrinterInformation`.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getVoltage

    public int getVoltage()
                   throws java.io.IOException

  Returns the printer battery voltage.

  Returns:
    the printer battery voltage in mVolts.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getVoltagePercentage

    public int getVoltagePercentage()
                             throws java.io.IOException

  Returns the printer battery level in percents.

  Returns:
    the printer battery voltage in percents (%).
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getTemperature

    public int getTemperature()
                       throws java.io.IOException

  Returns the printer head temperature.

  Returns:
    the printer head temperature in Celsius degrees.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getStatus

    public int getStatus()
                  throws java.io.IOException

  Returns the printer status.

  Returns:
    the printer status. The value of 4 means no paper.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### readCard

    public java.lang.String[] readCard(boolean first,
                                       boolean second,
                                       boolean third,
                                       int timeout)
                                throws java.io.IOException

  Reads the magnetic stripe card.

  If the `in` is `null`, a `NullPointerException` is thrown.

  If `first` is `false`, and `second` is `false`, and `third` is `false` then a `IllegalArgumentException` is thrown.

  If `wait` is negative, a `IllegalArgumentException` is thrown.

  Parameters:
    `first` - the flag indicates where to read first track (track 1).
    `second` - the flag indicates where to read second track (track 2).
    `third` - the flag indicates where to read third track (track 3).
    `timeout` - the time in milliseconds to read the card data. The actual scan time may differ, but will be as close as possible to this value.
  Returns:
    the String array of three elements which contains tracks data. If some track is not requested then the corresponding record in array is a `null`.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### readBarcode

    public java.lang.String readBarcode(int timeout)
                                 throws java.io.IOException

  Reads the barcode.

  If `in` is `null`, a `NullPointerException` is thrown.

  If `wait` is negative, a `IllegalArgumentException` is thrown.

  Parameters:
    `timeout` - the time in seconds to read the barcode. The actual scan time may differ, but will be as close as possible to this value.
  Returns:
    the barcode data in format: [type barcode]. The type of barcode is a numeric value and is separate from barcode with space character.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### reset

    public void reset()
               throws java.io.IOException

  Resets printer to it's default settings.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### turnOff

    public void turnOff()
                 throws java.io.IOException

  Turn off printer.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printSelfTest

    public void printSelfTest()
                       throws java.io.IOException

  Prints self test receipt.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### selectCodetable

    public void selectCodetable(int codetable)
                         throws java.io.IOException

  Selects a code table.

  If `codetable` is negative, a `IllegalArgumentException` is thrown.

  Parameters:
    `codetable` - the code table.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### setLineSpace

    public void setLineSpace(int lines)
                      throws java.io.IOException

  Sets the line space of text rows.

  Line space is the vertical distance between beginning of two consecutive text rows. The text rows can not be overlapped. When the `lines` value is less then vertical text size it shall be adjusted to the lower possible value.

  If `lines < 0 || lines > 255`, a `IllegalArgumentException` is thrown.

  Parameters:
    `lines` - the line space of text rows, value between 0 and 255.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### setAlign

    public void setAlign(int align)
                  throws java.io.IOException

  Sets alignment for the next printed text row or object.

  If `align` illegal, a `IllegalArgumentException` is thrown.

  Parameters:
    `align` - the alignment of text or object. See the `ALIGN_` * constant field values.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### feedPaper

    public void feedPaper(int lines)
                   throws java.io.IOException

  Feeds paper with specified lines number.

  If `lines < 0 || lines > 255`, a `IllegalArgumentException` is thrown.

  Parameters:
    `lines` - the lines to feed paper, value between 0 and 255.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### beep

    public void beep()
              throws java.io.IOException

  Sounds the buzzer.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### melody

    public void melody(java.lang.String data)
                throws java.io.IOException

  Making (beeping) a sequence of sounds with a certain frequency and duration.

  The data is in format, similar to the one used for writing notes and can be of any length. The first invalid character cancels the command.

  For more information please refer to printer documentation.

  Parameters:
    `data` - the note data.
  Throws:
    `java.io.IOException`

### printText

    public void printText(byte[] b)
                   throws java.io.IOException

  Prints a text using default charset for encoding.

  Parameters:
    `b` - the text in byte array.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printText

    public void printText(java.lang.String s)
                   throws java.io.IOException

  Prints a text using default charset for encoding.

  The text is encode into a sequence of bytes using the default charset encoding.

  If `s` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `s` - the text.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printText

    public void printText(java.lang.String s,
                          java.lang.String encoding)
                   throws java.io.IOException

  Prints a text using the named charset for encoding.

  The text is encode into a sequence of bytes using the given charset.

  If `s` is `null`, a `NullPointerException` is thrown.

  Parameters:
    `s` - the text.
    `encoding` - the name of a supported charset.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printTaggedText

    public void printTaggedText(java.lang.String s)
                         throws java.io.IOException

  Prints a tagged text using default charset for encoding.

  The text is encode into a sequence of bytes using the default charset encoding.

  Tags definition
  {reset} | Reset to default settings.
  {br} | Line break. Equivalent of new line.
  {b}, {/b} | Set or clear bold font style.
  {u}, {/u} | Set or clear underline font style.
  {i}, {/i} | Set or clear italic font style.
  {s}, {/s} | Set or clear small font style.
  {h}, {/h} | Set or clear high font style.
  {w}, {/w} | Set or clear wide font style.
  {left} | Aligns text to the left paper edge.
  {center} | Aligns text to the center of paper.
  {right} | Aligns text to the right paper edge.

  If `s` if `null`, a `NullPointerException` is thrown.

  Parameters:
    `s` - the tagged text to print.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printTaggedText

    public void printTaggedText(java.lang.String s,
                                java.lang.String encoding)
                         throws java.io.IOException

  Prints a tagged text using the named charset for encoding.

  The text is encode into a sequence of bytes using the given charset.

  If `s` if `null`, a `NullPointerException` is thrown.

  Parameters:
    `s` - the tagged text to print.
    `encoding` - the name of a supported charset.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `printTaggedText(String)`

### printArabicText

    public void printArabicText(int codetable,
                                java.lang.String text)
                         throws java.io.IOException

  Print Arabic text.

  Parameters:
    `codetable` - the Arabic codetable.
    `text` - the text to print.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printImage

    public void printImage(int[] argb,
                           int width,
                           int height,
                           int align,
                           boolean dither,
                           boolean crop)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### printImage

    public void printImage(int[] argb,
                           int width,
                           int height,
                           int align,
                           boolean dither)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### printCompressedImage

    public void printCompressedImage(int[] argb,
                                     int width,
                                     int height,
                                     int align,
                                     boolean dither,
                                     boolean crop)
                              throws java.io.IOException

  Throws:
    `java.io.IOException`

### printCompressedImage

    public void printCompressedImage(int[] argb,
                                     int width,
                                     int height,
                                     int align,
                                     boolean dither)
                              throws java.io.IOException

  Throws:
    `java.io.IOException`

### printLogo

    public void printLogo(boolean wide,
                          boolean high)
                   throws java.io.IOException

  Prints a stored bit image (logo).

  Parameters:
    `wide` - the flag specifies to print logo in double width size.
    `high` - the flag specifies to print logo in double height size.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printLogo

    public void printLogo()
                   throws java.io.IOException

  Prints a stored bit image (logo).

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### setBarcode

    public void setBarcode(int align,
                           boolean small,
                           int scale,
                           int hri,
                           int height)

  Sets the various barcode parameters.

  If `align` is negative, or `scale < 2 || scale > 4` , or `hri` is negative, or `height < 1 || height > 255`, then a `IllegalArgumentException` is thrown.

  Parameters:
    `align` - the align of barcode. See the `ALIGN_`* constant field values.
    `small` - the HRI code font size.
    `scale` - the scale factor of barcode, value between 2 and 4.
    `hri` - the HRI text position of barcode. See the `HRI_`* constant field values.
    `height` - the height of barcode, value between 1 and 255.

### printBarcode

    public void printBarcode(int type,
                             byte[] data)
                      throws java.io.IOException

  Prints a barcode.

  If `data` is `null`, a `NullPointerException` is thrown.

  If `type` is illegal, or `data.length` is not valid for a specified `type`, then a `IllegalArgumentException` is thrown.

  Parameters:
    `type` - the barcode type. See the `BARCODE_`* constant field values.
    `data` - the barcode data.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `setBarcode(int, boolean, int, int, int)`

### printBarcode

    public void printBarcode(int type,
                             java.lang.String data)
                      throws java.io.IOException

  Prints a barcode.

  The data is encode into a sequence of bytes using the default charset.

  If `data` is `null`, a `NullPointerException` is thrown.

  If `type` is not valid, or `data.length` is not valid for a specified `type`, then a IllegalArgumentException is thrown.

  Parameters:
    `type` - the barcode type. See the `BARCODE_`* constant field values.
    `data` - the barcode data.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `setBarcode(int, boolean, int, int, int)`

### printQRCode

    public void printQRCode(int size,
                            int eccLv,
                            byte[] data)
                     throws java.io.IOException

  Prints the QRCode.

  Parameters:
    `size` - the size of symbol, value in {1, 4, 6, 8, 10, 12, 14}.
    `eccLv` - the error collection control level, where

    1: L (7%)
    2: M (15%)
    3: Q (25%)
    4: H (30%)

    `data` - the QRCode data. The data must be between 1 and 448 symbols long.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printQRCode

    public void printQRCode(int size,
                            int eccLv,
                            java.lang.String data)
                     throws java.io.IOException

  Prints the QRCode.

  Parameters:
    `size` - the size of symbol, value in {1, 4, 6, 8, 10, 12, 14}.
    `eccLv` - the error collection control level, where

    1: L (7%)
    2: M (15%)
    3: Q (25%)
    4: H (30%)

    `data` - the QRCode data. The data must be between 1 and 448 symbols long.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### calibrateBMMSensor

    public void calibrateBMMSensor()
                            throws java.io.IOException

  Black mark mode sensor calibration.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### feedLabel

    public void feedLabel()
                   throws java.io.IOException

  Feed to the next label.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### selectPageMode

    public void selectPageMode()
                        throws java.io.IOException

  Switches from standard mode to page mode. In this mode the printing is not immediately, out is accumulated in a reserved for this purpose memory area.

  In page mode the result of incoming commands is forwarded to a reserved memory area (page). The page place, size and print direction is defined using `setPageRegion(int, int, int, int, int)`. At the end the collected information is printed using `printPage()`. Almost all commands works in page mode. The centering and right alignment is working in the currently defined page width.

  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `setPageRegion(int, int, int, int, int)`, `selectStandardMode()`

### selectStandardMode

    public void selectStandardMode()
                            throws java.io.IOException

  Switches from page mode to standard mode.

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### printPage

    public void printPage()
                   throws java.io.IOException

  Prints the non blank page area only in page mode.

  The command checks the whole memory of the page mode. The area from the first horizontal line wit at least 1 black dot to the last such line is printed.

  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `selectPageMode()`

### setPageRegion

    public void setPageRegion(int x,
                              int y,
                              int width,
                              int height,
                              int direction)
                       throws java.io.IOException

  Defines the relative position, size print direction of the page.

  If `x` is negative, or `y` is negative, or `width` is negative, or `height` is negative, or `direction` is not a valid value, then `IllegalArgumentException` is thrown.

  Parameters:
    `x` - the horizontal offset of the relative top left corner of the page.
    `y` - the vertical offset of the relative top left corner of the page.
    `width` - the width of the page.
    `height` - the height of the page.
    `direction` - the print direction of the page. See `PAGE_`* constant field values.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `selectPageMode()`

### setPageXY

    public void setPageXY(int x,
                          int y)
                   throws java.io.IOException

  Sets the print position in current page region.

  If the position is outside the current page region, the command is not accepted. The real new coordinates depend on the print direction.

  If `x` is negative, or `y` is negative, then `IllegalArgumentException` is thrown.

  Parameters:
    `x` - the horizontal position.
    `y` - the vertical position.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `selectPageMode()`

### drawPageRectangle

    public void drawPageRectangle(int x,
                                  int y,
                                  int width,
                                  int height,
                                  int fillMode)
                           throws java.io.IOException

  Draws a rectangle in page mode.

  If `x` is negative, or `y` is negative, or `width` is negative, or `height` is negative, or `fillMode` is not a valid value, then `IllegalArgumentException` is thrown.

  Parameters:
    `x` - the horizontal position of the top left corner of the rectangle in the page region.
    `y` - the vertical position of the top left corner of the rectangle in the the page region.
    `width` - the width of the rectangle.
    `height` - the height of the rectangle.
    `fillMode` - the fill mode used to draw the rectangle. See the `FILL_`* constant field values.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `selectPageMode()`

### drawPageFrame

    public void drawPageFrame(int x,
                              int y,
                              int width,
                              int height,
                              int fillMode,
                              int thickness)
                       throws java.io.IOException

  Draws a rectangle frame with selected thickness in page mode.

  If `x` is negative, or `y` is negative, or `width` is negative, or `height` is negative, or `fillMode` is not a valid value, or `thickness` is negative, then `IllegalArgumentException` is thrown.

  Parameters:
    `x` - the horizontal position of the top left corner of the rectangle frame in the page region.
    `y` - the vertical position of the top left corner of the rectangle frame in the the page region.
    `width` - the width of the rectangle frame.
    `height` - the height of the rectangle frame.
    `fillMode` - the fill mode used to draw the rectangle frame. See the `FILL_`* constant field values.
    `thickness` - the frame thickness.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `selectPageMode()`

### getSettings

    public java.lang.String[] getSettings(int type)
                                   throws java.io.IOException

  Reading printer settings.

  Parameters:
    `type` - the printer settings type. It can be one of the SETTINGS_* constant values.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### setIntensity

    public void setIntensity(int level)
                      throws java.io.IOException

  Set intensity level.

  Parameters:
    `level` - the intensity level
    - 0 - Intensity 60%
    - 1 - Intensity 75%
    - 2 - Intensity 90%
    - 3 - Intensity 100%
    - 4 - Intensity 120%
    - 5 - Intensity 140%
    - 6 - Intensity 160%
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### getTouchChip

    public TouchChip getTouchChip()

  Get instance of TouchChip module.

  Returns:
    the new instance.

### journalFormat

    public void journalFormat()
                       throws java.io.IOException

  Format journal

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### journalWrite

    public void journalWrite(byte[] data)
                      throws java.io.IOException

  Write journal data.

  Parameters:
    `data` - the data, up to 400 bytes long.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### journalWrite

    public void journalWrite(java.lang.String text,
                             java.lang.String charset)
                      throws java.io.IOException

  Write journal text.

  Parameters:
    `text` - the text, up to 400 symbols long.
    `charset` - the text charset.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### journalPrint

    public void journalPrint()
                      throws java.io.IOException

  Print journal

  Throws:
    `java.io.IOException` - if an I/O error occurs.

### journalRead

    public byte[] journalRead()
                       throws java.io.IOException

  Read journal

  Returns:
    journal data.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### journalRead

    public java.lang.String journalRead(java.lang.String charset)
                                 throws java.io.IOException

  Read journal

  Parameters:
    `charset` - the text charset.
  Returns:
    journal data.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD