DataForSendToPrinterPos58

net.posprinter.utils

## Class DataForSendToPrinterPos58

- java.lang.Object
- - net.posprinter.utils.DataForSendToPrinterPos58

-     public class DataForSendToPrinterPos58
      extends java.lang.Object

  As the instruction processing tools. The processing instruction is only applicable to 58mm series of needle printer XP 76xx series products. The specific decription and effect which you used should refer to programming manuals.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataForSendToPrinterPos58()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `allowOrForbidPressButton(int n)` Enable or disable button ESC c 5 n
    `static byte[]` | `CancelChineseCharModel()` cancel chinese-char model FS .
    `static byte[]` | `cancelUserDefinedCharacters(int n)` Cancel user-defined characters ESC ? n Cancel the user-defined characters in the code for the n character
    `static byte[]` | `creatCashboxContorlPulse(int m, int t1, int t2)` creat cashbox contorl pulse ESC p m t1 t2
    `static byte[]` | `definedDownLoadBmp(android.graphics.Bitmap bitmap, BitmapToByteData.BmpType bmpType)` defined downLoad bitmap GS x y [ d1...d(xy*8)] single bitmap £ºn=(width+7)/8;h=(height+7)/8;n*h<=912,1<=n<=255,1<=h<=48,or else return new byte[0].
    `static byte[]` | `definedFlashBmp(java.util.List<android.graphics.Bitmap> list, int n, BitmapToByteData.BmpType bmpType)` defined Flash bitmap FS q n [xL xH yL yH d1...dk]...[xL xH yL yH d1...dk] The maximum FLASH of storage space for 8KB£¬[xL xH yL yH d1...dk]...[xL xH yL yH d1...dk] The sum of not more than8096 single bitmap£ºn=(width+7)/8;h=(height+7)/8;n*h<=1023,1<=n<=1023,1<=h<=288,or return new byte[0].
    `static byte[]` | `definedUserDefinedChineseChar(int c2, byte[] b)` defined user-defined chinese character FS 2 c1 c2 d1...dk
    `static byte[]` | `defineuserDefinedCharacters(int c1, int c2, byte[] b)` Define the user defined chararcters ESC $ Y c1 c2 [x1 d1...d(x1*y)]...[xk d1...d(y*xk)]
    `static byte[]` | `horizontalPositioning()` horizontal orientation command HT
    `static byte[]` | `initializePrinter()` Initialize printer ESC @
    `static byte[]` | `printAndFeed(int n)` print and feed ESC J n
    `static byte[]` | `printAndFeedForward(int n)` print and feed forward ESC d n
    `static byte[]` | `printAndFeedLine()` print and feed command LF
    `static byte[]` | `printBarcode(int m, int n, java.lang.String content)` print barcode GS k m n d1...dn
    `static byte[]` | `printBarcode(int m, java.lang.String content)` print barcode GS k m d1...dk NUL
    `static byte[]` | `printBmpInFLASH(int n, int m)` print bitmap in FLASH FS p n m
    `static byte[]` | `printDownLoadBmp(int m)` print download bitmap GS / m
    `static byte[]` | `printRasterBmp(int m, android.graphics.Bitmap bitmap, BitmapToByteData.BmpType bmpType)` print raster bitmap GS v 0 m
    `static byte[]` | `queryPrinterState()` check the printer state ESC v only work for serial interface and ethernet interface
    `static byte[]` | `selectAlignment(int n)` Select alignment ESC a n
    `static byte[]` | `selectBmpModel(int m, int nL, int nH, byte[] b)` Select the bitmap mode ESC * m nL nH d1 d2...dk
    `static byte[]` | `selectCharacterCodePage(int n)` select character codepage ESC t n
    `static byte[]` | `selectCharacterSize(int n)` Select a character size GS ! n
    `static byte[]` | `selectChineseCharModel()` select chinese-char model FS &
    `static byte[]` | `selectFont(int n)` Select Font ESC M n
    `static byte[]` | `selectHRICharacterPrintPosition(int n)` select HRI character of barcode position to print GS H n HRI is the explanation of the barcode content GS H n
    `static byte[]` | `selectHRIFont(int n)` select HRI font type for the barcode content GS f n
    `static byte[]` | `selectInternationalCharacterSets(int n)` select international character sets ESC R n
    `static byte[]` | `selectOrCancelBoldModel(int n)` Select or cancel the bold model ESC E n
    `static byte[]` | `selectOrCancelChineseCharDoubleWH(int n)` select or cancel chinese double width and height FS W n
    `static byte[]` | `selectOrCancelChineseCharUnderLineModel(int n)` select or cancel chinese-char underline model FS - n
    `static byte[]` | `selectOrCancelConvertPrintModel(int n)` select or cancel convert print model ESC { n
    `static byte[]` | `selectOrCancelCW90(int n)` Select or cancel 90 degrees clockwise This command is available only in page mode ESC V n
    `static byte[]` | `selectOrCancelDoubelPrintModel(int n)` Select or cancel double print mode ESC G n
    `static byte[]` | `selectOrCancelInvertPrintModel(int n)` select or cancel invert print mode GS B n
    `static byte[]` | `selectOrCancelUnderlineModel(int n)` Select or cancel underline mode ESC-n
    `static byte[]` | `selectOrCancleCustomChar(int n)` Select or cancel user-defined characters ESC % n
    `static byte[]` | `selectPrintModel(int n)` select print model ESC £¡n
    `static byte[]` | `setAbsolutePrintPosition(int m, int n)` Set the absolute print position ESC $ nL nH
    `static byte[]` | `setBarcodeHeight(int n)` set barcode height GS h n
    `static byte[]` | `setBarcodeWidth(int n)` set barcode width GS w n
    `static byte[]` | `setCharRightSpace(int n)` seting the right side space of the character string ESC SP n
    `static byte[]` | `setChineseCharacterModel(int n)` set chinese-char model FS ! n
    `static byte[]` | `setChineseCharLeftAndRightSpace(int n1, int n2)` setting chinese character left and right space FS S n1 n2
    `static byte[]` | `setDefultLineSpacing()` Set the default line spacing ESC 2 about 3.75mm
    `static byte[]` | `setHorizontalAndVerticalMoveUnit(int x, int y)` setting the positon of content horizontal and vertical move GS P x y
    `static byte[]` | `setHorizontalmovementPosition(byte[] b)` Set the horizontal movement position ESC D n1...nk NUL;
    `static byte[]` | `setLeftSpace(int nL, int nH)` set left space GS L nL nH
    `static byte[]` | `setLineSpaceing(int n)` set line spaceing ESC 3 n
    `static byte[]` | `setPrintAreaWidth(int nL, int nH)` setting the width of print area GS W nL nH
    `static byte[]` | `setRelativeHorizontalPrintPosition(int nL, int nH)` set relative horizontal print position Please refer to the details of programming instruction manual ESC \ nL nH
    `static byte[]` | `strTobytes(java.lang.String str)` string to byte[]

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DataForSendToPrinterPos58

          public DataForSendToPrinterPos58()

  - ### Method Detail

    - #### horizontalPositioning

          public static byte[] horizontalPositioning()

      horizontal orientation command HT
      Returns:
        byte[];

    - #### printAndFeedLine

          public static byte[] printAndFeedLine()

      print and feed command LF
      Returns:
        byte[];

    - #### setCharRightSpace

          public static byte[] setCharRightSpace(int n)

      seting the right side space of the character string ESC SP n
      Parameters:
        `n,` - On behalf of the distance between the size of the variable(range:0-255)£»

    - #### selectPrintModel

          public static byte[] selectPrintModel(int n)

      select print model ESC £¡n
      Parameters:
        `n` - for print mode variable,(range:0-255)

    - #### setAbsolutePrintPosition

          public static byte[] setAbsolutePrintPosition(int m,
                                        int n)

      Set the absolute print position ESC $ nL nH
      Parameters:
        `m£¬n£¬m+n*256:The` - location of the representatives from the beginning of a line,(range:0-255).

    - #### selectOrCancleCustomChar

          public static byte[] selectOrCancleCustomChar(int n)

      Select or cancel user-defined characters ESC % n
      Parameters:
        `n£¬0-255£¬The` - lowest is 1, use; 0, do not use£»

    - #### defineuserDefinedCharacters

          public static byte[] defineuserDefinedCharacters(int c1,
                                           int c2,
                                           byte[] b)

      Define the user defined chararcters ESC $ Y c1 c2 [x1 d1...d(x1*y)]...[xk d1...d(y*xk)]
      Parameters:
        `c1£¬c2£¬c1:start` - of the character£¬c2:end of the character£¬(range:32<=c1<=c2<=127);
        `b£¬The` - format of the set b is [x1 d1...d(x1*y)]...[xk d1...d(y*xk)]£¬Set B for download character character data, character rules for details, please refer to the programming manual;

    - #### selectBmpModel

          public static byte[] selectBmpModel(int m,
                              int nL,
                              int nH,
                              byte[] b)

      Select the bitmap mode ESC * m nL nH d1 d2...dk
      Parameters:
        `m£º0,1,32£¬33,Different` - representative point density
        `nL£º0-255` -
        `nH£º0-3` -
        `b£¬b={d1` - d2...dk}£¬m=0 or 1,k=nL+nH*256;m=32 or 33,k=(nL+nH*256)*3;0<=d<=255; Please refer to the instruction manual programming

    - #### selectOrCancelUnderlineModel

          public static byte[] selectOrCancelUnderlineModel(int n)

      Select or cancel underline mode ESC-n
      Parameters:
        `n:0,48` - Cancel the underline£»1,49 underlined (1 points wide); 2,50 (2 bit wide) underline£©;

    - #### setDefultLineSpacing

          public static byte[] setDefultLineSpacing()

      Set the default line spacing ESC 2 about 3.75mm

    - #### setLineSpaceing

          public static byte[] setLineSpaceing(int n)

      set line spaceing ESC 3 n
      Parameters:
        `n` - ranges£º0-255

    - #### cancelUserDefinedCharacters

          public static byte[] cancelUserDefinedCharacters(int n)

      Cancel user-defined characters ESC ? n Cancel the user-defined characters in the code for the n character
      Parameters:
        `n` - ranges:32-127

    - #### initializePrinter

          public static byte[] initializePrinter()

      Initialize printer ESC @

    - #### setHorizontalmovementPosition

          public static byte[] setHorizontalmovementPosition(byte[] b)

      Set the horizontal movement position ESC D n1...nk NUL;
      Parameters:
        `b={n1...nk};k<=32;Jump` - distance = character width *n£» The number and size of the b parameter settings refer to the programming manual

    - #### selectOrCancelBoldModel

          public static byte[] selectOrCancelBoldModel(int n)

      Select or cancel the bold model ESC E n
      Parameters:
        `n£¬0-255£¬The` - lowest is 1, bold; 0, cancel.

    - #### selectOrCancelDoubelPrintModel

          public static byte[] selectOrCancelDoubelPrintModel(int n)

      Select or cancel double print mode ESC G n
      Parameters:
        `n£¬0-255£¬The` - lowest is 1, double choose print; the lowest is 0, cancel the double print

    - #### printAndFeed

          public static byte[] printAndFeed(int n)

      print and feed ESC J n
      Parameters:
        `n` - ranges£º0-255

    - #### selectFont

          public static byte[] selectFont(int n)

      Select Font ESC M n
      Parameters:
        `n` - £º0£¬1£¬48£¬49£»0£¬48 standard font£»1£¬49 compress font

    - #### selectInternationalCharacterSets

          public static byte[] selectInternationalCharacterSets(int n)

      select international character sets ESC R n
      Parameters:
        `n£º0-15£»A` - representative of an international character set

    - #### selectOrCancelCW90

          public static byte[] selectOrCancelCW90(int n)

      Select or cancel 90 degrees clockwise This command is available only in page mode ESC V n
      Parameters:
        `n:0<=n<=1,48<=n<=49;0,48cancel£¬1,49` - choose

    - #### setRelativeHorizontalPrintPosition

          public static byte[] setRelativeHorizontalPrintPosition(int nL,
                                                  int nH)

      set relative horizontal print position Please refer to the details of programming instruction manual ESC \ nL nH
      Parameters:
        `nL,nH` - ranges£º0-255

    - #### selectAlignment

          public static byte[] selectAlignment(int n)

      Select alignment ESC a n
      Parameters:
        `n:0-2` - or 48-50£»Respectively: left aligned, centered, right aligned

    - #### allowOrForbidPressButton

          public static byte[] allowOrForbidPressButton(int n)

      Enable or disable button ESC c 5 n
      Parameters:
        `n£º0-255£¬The` - lowest is 0£¬button ennable ;The lowest is 1,button disable£»

    - #### printAndFeedForward

          public static byte[] printAndFeedForward(int n)

      print and feed forward ESC d n
      Parameters:
        `n:0-255£»` -

    - #### creatCashboxContorlPulse

          public static byte[] creatCashboxContorlPulse(int m,
                                        int t1,
                                        int t2)

      creat cashbox contorl pulse ESC p m t1 t2
      Parameters:
        `m` - £ºConnecting pin,ranges£º0,1,48,49£»
        `t1,t2£º0-255` -

    - #### selectCharacterCodePage

          public static byte[] selectCharacterCodePage(int n)

      select character codepage ESC t n
      Parameters:
        `n£º0<=n<=10,16<=n<=19;` -

    - #### selectOrCancelConvertPrintModel

          public static byte[] selectOrCancelConvertPrintModel(int n)

      select or cancel convert print model ESC { n
      Parameters:
        `n£ºThe` - lowest is 0 ,cancel;the lowest is 1 ,choose,ranges£º0-255£»

    - #### printBmpInFLASH

          public static byte[] printBmpInFLASH(int n,
                               int m)

      print bitmap in FLASH FS p n m
      Parameters:
        `n£¬Bitmap` - representation£¬0-255
        `m£º0-3` - or 48-51

    - #### definedFlashBmp

          public static byte[] definedFlashBmp(java.util.List<android.graphics.Bitmap> list,
                               int n,
                               BitmapToByteData.BmpType bmpType)

      defined Flash bitmap FS q n [xL xH yL yH d1...dk]...[xL xH yL yH d1...dk] The maximum FLASH of storage space for 8KB£¬[xL xH yL yH d1...dk]...[xL xH yL yH d1...dk] The sum of not more than8096 single bitmap£ºn=(width+7)/8;h=(height+7)/8;n*h<=1023,1<=n<=1023,1<=h<=288,or return new byte[0]. The height of the bitmap, the best is divisible by 8
      Parameters:
        `list` - bitmap list£¬The bitmap object stored in the flash ,list is null or size is 0£¬return a new byte[0]£»
        `n` - the size of list
        `bmptype` - The type you want to print the bitmap,Threshold and Dithering

    - #### selectCharacterSize

          public static byte[] selectCharacterSize(int n)

      Select a character size GS ! n
      Parameters:
        `n` - :0-255£»n: 0-3 set the height of the characters, 4-7 is used to set the width of the characters

    - #### definedDownLoadBmp

          public static byte[] definedDownLoadBmp(android.graphics.Bitmap bitmap,
                                  BitmapToByteData.BmpType bmpType)

      defined downLoad bitmap GS x y [ d1...d(xy*8)] single bitmap £ºn=(width+7)/8;h=(height+7)/8;n*h<=912,1<=n<=255,1<=h<=48,or else return new byte[0]. The height of the bitmap, the best is divisible by 8£¬or else print error.
      Parameters:
        `bitmap` - You want to download the bitmap to the printer
        `bmptype` - The type you want to print the bitmap,Threshold and Dithering

    - #### printDownLoadBmp

          public static byte[] printDownLoadBmp(int m)

      print download bitmap GS / m
      Parameters:
        `m£¬The` - specified print mode£¬ranges£º0-3 or 48-51£»

    - #### selectOrCancelInvertPrintModel

          public static byte[] selectOrCancelInvertPrintModel(int n)

      select or cancel invert print mode GS B n
      Parameters:
        `n£º0-255£¬The` - lowest is 0 ,cancel;the lowest is 1 ,choose

    - #### selectHRICharacterPrintPosition

          public static byte[] selectHRICharacterPrintPosition(int n)

      select HRI character of barcode position to print GS H n HRI is the explanation of the barcode content GS H n
      Parameters:
        `n` - (range:0-3 or 48-51£»position of the barcode content)

    - #### setLeftSpace

          public static byte[] setLeftSpace(int nL,
                            int nH)

      set left space GS L nL nH
      Parameters:
        `nL£¬nH£¬range:0-255£¬£¨nl+nh*256£©` - horizontal movement represent left space. unit: inch

    - #### setHorizontalAndVerticalMoveUnit

          public static byte[] setHorizontalAndVerticalMoveUnit(int x,
                                                int y)

      setting the positon of content horizontal and vertical move GS P x y
      Parameters:
        `x:` - param of horizonatal£¬range:0-255
        `y:` - param of vertical , range :0-255 x=0 and y=0,x,y are set to the default value

    - #### setPrintAreaWidth

          public static byte[] setPrintAreaWidth(int nL,
                                 int nH)

      setting the width of print area GS W nL nH
      Parameters:
        `(nl+nh*256)*Lateral` - movement unit£¬width of print area

    - #### selectHRIFont

          public static byte[] selectHRIFont(int n)

      select HRI font type for the barcode content GS f n
      Parameters:
        `n` - £º(0,48 : standard);(1,49:compression)

    - #### setBarcodeHeight

          public static byte[] setBarcodeHeight(int n)

      set barcode height GS h n
      Parameters:
        `n` - £º1-255;defaul :162

    - #### printBarcode

          public static byte[] printBarcode(int m,
                            java.lang.String content)

      print barcode GS k m d1...dk NUL
      Parameters:
        `m,barcode` - type£º0-6,65-73£¬when m=73,content must add the selection of charset , such as £º{A£¬{B£¬{C ...£»
        `content` - :string content of the barcode. The size and the range of the string should refer to instruction set of barcode print

    - #### printBarcode

          public static byte[] printBarcode(int m,
                            int n,
                            java.lang.String content)

      print barcode GS k m n d1...dn
      Parameters:
        `m,barcode` - type£º0-6,65-73£¬when m=73,content must add the selection of charset , such as £º{A£¬{B£¬{C ...£»
        `n` - limitation of data lenght. size of content can not exceed the n
        `content` - :string content of the barcode. The size and the range of the string should refer to instruction set of barcode print

    - #### printRasterBmp

          public static byte[] printRasterBmp(int m,
                              android.graphics.Bitmap bitmap,
                              BitmapToByteData.BmpType bmpType)

      print raster bitmap GS v 0 m
      Parameters:
        `m` - :(print type:0-3 or 48-51 ;defaul typem=0;)
        `bitmap` - bitmap (please refer to to Programming manual by using this API)
        `bmpType` - Processing into a single color bitmap

    - #### setBarcodeWidth

          public static byte[] setBarcodeWidth(int n)

      set barcode width GS w n
      Parameters:
        `n` - range:2-6;default:3£»

    - #### setChineseCharacterModel

          public static byte[] setChineseCharacterModel(int n)

      set chinese-char model FS ! n
      Parameters:
        `n:0-255£»diferent` - location of the byte represent diferent char model

    - #### selectChineseCharModel

          public static byte[] selectChineseCharModel()

      select chinese-char model FS &

    - #### selectOrCancelChineseCharUnderLineModel

          public static byte[] selectOrCancelChineseCharUnderLineModel(int n)

      select or cancel chinese-char underline model FS - n
      Parameters:
        `n£º0-2` - or 48-50£»

    - #### CancelChineseCharModel

          public static byte[] CancelChineseCharModel()

      cancel chinese-char model FS .

    - #### definedUserDefinedChineseChar

          public static byte[] definedUserDefinedChineseChar(int c2,
                                             byte[] b)

      defined user-defined chinese character FS 2 c1 c2 d1...dk
      Parameters:
        `c2:A1H<=c2<=FEH` -
        `b,length:72£¬` - data size of the user-defined chinese character.

    - #### setChineseCharLeftAndRightSpace

          public static byte[] setChineseCharLeftAndRightSpace(int n1,
                                               int n2)

      setting chinese character left and right space FS S n1 n2
      Parameters:
        `n1:left` - space£¬(range:0-255)
        `n2:right` - space£¬(range:0-255)

    - #### selectOrCancelChineseCharDoubleWH

          public static byte[] selectOrCancelChineseCharDoubleWH(int n)

      select or cancel chinese double width and height FS W n
      Parameters:
        `n£º0-255£»only` - the lowest order bit effect .(0:cancel;1:select)

    - #### queryPrinterState

          public static byte[] queryPrinterState()

      check the printer state ESC v only work for serial interface and ethernet interface

    - #### strTobytes

          public static byte[] strTobytes(java.lang.String str)

      string to byte[]