The LinePrinter class supports these methods to write text to the printer and position the printhead:
public void write(byte[] bytes) throws LinePrinterException
public void write(String aStr) throws LinePrinterException
public void writeLine(String aStr) throws LinePrinterException
public void newLine(int numLines) throws LinePrinterException
public void flush() throws LinePrinterException public void sendCustomCommand(String aCommandID) public void formFeed() throws PrinterException
To write text to the printer, use the write(String) method.
To send custom printer commands to the printer, use the write(byte[]) method.
To send a certain text and/or command sequence multiple times, you may define a custom setting and call the sendCustomCommand method with the setting name to send the defined setting value to the printer. Custom commands may be defined in the commands and attributes file, or added to the current printer settings via the LinePrinter.setSettingBytes and LinePrinter.setSettingString methods.
The write methods and the sendCustomCommand method only write the data to an internal print buffer. The data is sent to the printer through the transport medium when the buffer is full or when the newLine or flush method is called.
The newLine method advances the printer the specified number of lines and flushes the internal print buffer.
The writeLine method is a convenient method that writes the data followed by a new line.
The formFeed method feeds the paper. The LinePrinter class inherits this method from the Printer class. When it is called from a LinePrinter object, the method throws a LinePrinterException if an unexpected error occurs.