com.citizen.jpos.printer
Class ESCPOSPrinter

java.lang.Object
  extended by com.citizen.jpos.printer.ESCPOSPrinter

public class ESCPOSPrinter
extends java.lang.Object

ESCPOSPrinter

Since:
1.03

Constructor Summary
ESCPOSPrinter()
           
ESCPOSPrinter(DeviceConnection connection)
           
ESCPOSPrinter(java.lang.String charset)
          Single Connection Constructor.
ESCPOSPrinter(java.lang.String charset, DeviceConnection connection)
          Multi Connection Constructor.
 
Method Summary
 int asbOff()
           
 int asbOn()
           
 void clearPageModeData()
           
 void cutPaper()
           
 int drawerSts()
           
 boolean isASBMode()
           
 void lineFeed(int lfCount)
          2.8.
 void openDrawer(int pinNum, int onTime, int offTime)
           
 void printBarCode(java.lang.String data, int symbology, int height, int width, int alignment, int textPosition)
           
 int printBitmap(android.graphics.Bitmap bitmap, int alignment, int size)
          2.6.
 int printBitmap(java.lang.String bitmapName, int alignment)
          2.6.
 int printBitmap(java.lang.String bitmapName, int alignment, int size)
           
 int printerCheck()
           
 int printerSts()
           
 void printNormal(java.lang.String data)
          2.3.
 void printNVBitmap(int nvImageNumber)
          2.11.
 void printNVBitmap(int nvImageNumber, int size)
           
 void printPageModeData()
           
 void printPDF417(java.lang.String pdfData, int dataLength, int numberOfColumns, int cellWidth, int alignment)
          2.13.
 void printQRCode(java.lang.String data, int dataLength, int moduleSize, int ecLevel, int alignment)
          2.14.
 void printString(java.lang.String data)
          2.4.
 void printText(java.lang.String data, int alignment, int attribute, int textSize)
          2.5.
 int receiveByte(byte[] dataBuffer)
          For OEM MSR °ú µ¿½Ã»ç¿ëÇÏ¸é ¾ÈµÊ
 void sendByte(byte[] dataBuffer)
          For OEM
 void setAbsoluteHorizontal(int absolutePosition)
           
 void setAbsoluteVertical(int absolutePosition)
           
 void setCharSet(java.lang.String charSet)
          SetCharSet.
 void setDPI(int dpi)
           
 void setPageMode(boolean pagemode)
           
 void setPrintDirection(int direction)
           
 void setPrintingArea(int pageHeight)
          Deprecated.  
 void setPrintingArea(int pageWidth, int pageHeight)
           
 void setRelativeHorizontal(int relativePosition)
           
 void setRelativeVertical(int relativePosition)
           
 int status()
          2.10. status (Mobile Printer Only)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESCPOSPrinter

public ESCPOSPrinter()

ESCPOSPrinter

public ESCPOSPrinter(java.lang.String charset)
Single Connection Constructor.

Parameters:
charset -
 "ISO-8859-1" (Default)
 "EUC-KR"
 

ESCPOSPrinter

public ESCPOSPrinter(DeviceConnection connection)

ESCPOSPrinter

public ESCPOSPrinter(java.lang.String charset,
                     DeviceConnection connection)
Multi Connection Constructor.

Parameters:
charset -
 "ISO-8859-1" (Default)
 "EUC-KR"
 
connection -
Method Detail

setCharSet

public void setCharSet(java.lang.String charSet)
SetCharSet.

Parameters:
charSet -

printNormal

public void printNormal(java.lang.String data)
                 throws java.io.UnsupportedEncodingException
2.3. PrintNormal

Parameters:
data - - Unicode string. It is same as PrintNormal function in OLE POS Command.
Throws:
java.io.UnsupportedEncodingException

printString

public void printString(java.lang.String data)
                 throws java.io.UnsupportedEncodingException
2.4. PrintString

Parameters:
data - - Unicode string. It sets Unicode String to print.
Throws:
java.io.UnsupportedEncodingException

sendByte

public void sendByte(byte[] dataBuffer)
For OEM


receiveByte

public int receiveByte(byte[] dataBuffer)
                throws java.io.IOException,
                       java.lang.InterruptedException
For OEM MSR °ú µ¿½Ã»ç¿ëÇÏ¸é ¾ÈµÊ

Throws:
java.lang.InterruptedException
java.io.IOException

printText

public void printText(java.lang.String data,
                      int alignment,
                      int attribute,
                      int textSize)
               throws java.io.UnsupportedEncodingException
2.5. PrintText

Parameters:
data - - Unicode string. It sets Unicode text to print.
alignment - - This value is alignment. It sets text alignment.
 CMP_ALIGNMENT_LEFT Left alignment 
 CMP_ALIGNMENT_CENTER Center alignment
 CMP_ALIGNMENT_RIGHT Right alignment
 
attribute - - This value is text attributes. It sets text attributes to print.
 CMP_FNT_DEFAULT FontA, Set up as a standard
 CMP_FNT_FONTB Set up as FontB
 CMP_FNT_BOLD Set up as Bold attribute
 CMP_FNT_UNDERLINE Set up as Underline attribute
 
textSize - - This value is text size. It sets text size to print.
 CMP_TXT_1WIDTH Set up width ratio as x1 
 CMP_TXT_2WIDTH Set up width ratio as x2 
 CMP_TXT_3WIDTH Set up width ratio as x3 
 CMP_TXT_4WIDTH Set up width ratio as x4 
 CMP_TXT_5WIDTH Set up width ratio as x5 
 CMP_TXT_6WIDTH Set up width ratio as x6 
 CMP_TXT_7WIDTH Set up width ratio as x7 
 CMP_TXT_8WIDTH Set up width ratio as x8
 
 CMP_TXT_1HEIGHT Set up height ratio as x1 
 CMP_TXT_2HEIGHT Set up height ratio as x2 
 CMP_TXT_3HEIGHT Set up height ratio as x3 
 CMP_TXT_4HEIGHT Set up height ratio as x4 
 CMP_TXT_5HEIGHT Set up height ratio as x5
 CMP_TXT_6HEIGHT Set up height ratio as x6 
 CMP_TXT_7HEIGHT Set up height ratio as x7 
 CMP_TXT_8HEIGHT Set up height ratio as x8
 
Throws:
java.io.UnsupportedEncodingException

printBitmap

public int printBitmap(java.lang.String bitmapName,
                       int alignment)
                throws java.io.IOException
2.6. PrintBitmap

Parameters:
bitmapName - - Unicode string. This value is the bitmap file name
alignment - - This value is alignment. It sets image alignment.
 CMP_ALIGNMENT_LEFT Left alignment 
 CMP_ALIGNMENT_CENTER Center alignment
 CMP_ALIGNMENT_RIGHT Right alignment
 
Returns:
LKPrint.CMP_SUCCESS, LKPrint.CMP_FAIL
Throws:
java.io.IOException

printBitmap

public int printBitmap(java.lang.String bitmapName,
                       int alignment,
                       int size)
                throws java.io.IOException
Throws:
java.io.IOException

printBitmap

public int printBitmap(android.graphics.Bitmap bitmap,
                       int alignment,
                       int size)
                throws java.io.IOException
2.6. PrintBitmap

Parameters:
bitmap -
alignment -
Returns:
Throws:
java.io.IOException

printBarCode

public void printBarCode(java.lang.String data,
                         int symbology,
                         int height,
                         int width,
                         int alignment,
                         int textPosition)
                  throws java.io.UnsupportedEncodingException
Parameters:
width - - This values barcode width in Dot Units. It sets total barcode width to print. CMP_BCS_3OF5 Print 3 out of 5(KorMail) BarCode CMP_BCS_PDF417 Print PDF417 BarCode CMP_BCS_MAXICODE Print MAXICODE BarCode CMP_BCS_QRCODE Print QrCode BarCode CMP_BCS_DATAMATRIX Print DataMatrix BarCode / /** 2.7. PrintBarCode
data - - Unicode string. It sets the barcode data to print.
symbology - - This value is barcode symbol type. It sets barcode type to print.
 CMP_BCS_UPCA Print UPC A BarCode 
 CMP_BCS_UPCE Print UPC E BarCode
 CMP_BCS_EAN8 Print EAN-8 BarCode 
 CMP_BCS_EAN13 Print EAN-13 BarCode
 CMP_BCS_JAN8 Print JAN-8 BarCode 
 CMP_BCS_JAN13 Print JAN-13 BarCode
 CMP_BCS_ITF Print Interleaved 2 of 5 
 CMP_BCS_Codabar Print Codabar BarCode
 CMP_BCS_Code39 Print Code 3 of 9 BarCode 
 CMP_BCS_Code93 Print Code 93 BarCode 
 CMP_BCS_Code128 Print Code 128 BarCode 
 
height - - This value is barcode height in Dot Units. It sets barcode height to print.
width - - This values fixed barcode width. (2 <= width <= 6)
alignment - - This value is alignment. It sets barcode alignment.
 CMP_ALIGNMENT_LEFT Left alignment 
 CMP_ALIGNMENT_CENTER Center alignment
 CMP_ALIGNMENT_RIGHT Right alignment
 
textPosition - - This value is printing position of barcode HRI letters(barcode data).
 CMP_HRI_TEXT_NONE Do not print barcode data 
 CMP_HRI_TEXT_ABOVE Print barcode data above the barcode 
 CMP_HRI_TEXT_BELOW Print barcode data below the barcode
 
Throws:
java.io.UnsupportedEncodingException

lineFeed

public void lineFeed(int lfCount)
2.8. LineFeed

Parameters:
lfCount - - This value is the number of lines for line feeding. It sets line feeding counter.

printerCheck

public int printerCheck()

status

public int status()
2.10. status (Mobile Printer Only)

Returns:
CMP_STS_NORMAL: Printer Status is No Error and MSR is not Ready.

CMP_PAPER_EMPTY : Printer Status is no paper.

CMP_COVER_OPEN : Printer Cover is open.

CMP_BATTERY_LOW : Printer battery capacity is low.

CMP_STS_MSR_READ : Currently MSR in read mode, printing is impossible.


printNVBitmap

public void printNVBitmap(int nvImageNumber)
2.11. PrintNVBitmap

Parameters:
nvImageNumber - - It sets the Number image stored in Flash Memory to print.

printNVBitmap

public void printNVBitmap(int nvImageNumber,
                          int size)

printPDF417

public void printPDF417(java.lang.String pdfData,
                        int dataLength,
                        int numberOfColumns,
                        int cellWidth,
                        int alignment)
                 throws java.io.UnsupportedEncodingException
2.13. PrintPDF417

Parameters:
pdfData - - It sets the data for PDF417 printing.
dataLength - - It sets the size of data to print PDF417.
numberOfColumns - - It sets the size of Column to print PDF417. (1 ~ 20)
cellWidth - - It sets the size of Cell to print PDF417.
alignment - - It sets the value for PDF417 alignment
 CMP_ALIGNMENT_LEFT Left alignment 
 CMP_ALIGNMENT_CENTER Center alignment 
 CMP_ALIGNMENT_RIGHT Right alignment
 
Throws:
java.io.UnsupportedEncodingException

printQRCode

public void printQRCode(java.lang.String data,
                        int dataLength,
                        int moduleSize,
                        int ecLevel,
                        int alignment)
                 throws java.io.UnsupportedEncodingException
2.14. PrintQRCode

Parameters:
data - - It sets the data for QRCode printing.
dataLength - - It sets the size of data to print QRCode.
moduleSize - - It sets the size of module to print QRCode. (1 ~ 20)
ecLevel - - It sets the Error Correction Level to print QRCode. (0 ~ 3 [Default = 0])
 CMP_QRCODE_EC_LEVEL_L Error Correction Level L(7%)
 CMP_QRCODE_EC_LEVEL_M Error Correction Level M(15%)
 CMP_QRCODE_EC_LEVEL_Q Error Correction Level Q(25%)
 CMP_QRCODE_EC_LEVEL_H Error Correction Level H(30%)
 
alignment - - It sets the value for QRCode alignment
 CMP_ALIGNMENT_LEFT Left alignment
 CMP_ALIGNMENT_CENTER Center alignment
 CMP_ALIGNMENT_RIGHT Right alignment
 
Throws:
java.io.UnsupportedEncodingException

isASBMode

public boolean isASBMode()

asbOn

public int asbOn()

asbOff

public int asbOff()

printerSts

public int printerSts()
               throws java.io.IOException,
                      java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

drawerSts

public int drawerSts()
              throws java.io.IOException,
                     java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

openDrawer

public void openDrawer(int pinNum,
                       int onTime,
                       int offTime)

cutPaper

public void cutPaper()

printPageModeData

public void printPageModeData()

clearPageModeData

public void clearPageModeData()

setPageMode

public void setPageMode(boolean pagemode)

setPrintDirection

public void setPrintDirection(int direction)

setDPI

public void setDPI(int dpi)

setPrintingArea

public void setPrintingArea(int pageWidth,
                            int pageHeight)

setPrintingArea

public void setPrintingArea(int pageHeight)
Deprecated. 


setAbsoluteHorizontal

public void setAbsoluteHorizontal(int absolutePosition)

setRelativeHorizontal

public void setRelativeHorizontal(int relativePosition)

setAbsoluteVertical

public void setAbsoluteVertical(int absolutePosition)

setRelativeVertical

public void setRelativeVertical(int relativePosition)