com.java4less.textprinter
Class TextPrinter

java.lang.Object
  |
  +--com.java4less.textprinter.TextPrinter
Direct Known Subclasses:
DiabloPrinter, ESCP2Printer, ESCPPrinter, PCL3Printer, PCL5Printer, PlainPrinter, PPDSPrinter, ProPrinter

public abstract class TextPrinter
extends java.lang.Object


Field Summary
 char blCornerChar
          bottom left corner character (for line printing).
 char brCornerChar
          bottom right corner character (for line printing).
 boolean calculateLineSpacing
          calculate line spacing based on the number of lines in the page
 boolean calculatePitchAndHMI
          calculate character size based on the desired number of columns?
 char crossLineChar
          crossing lines characters
 boolean debug
          enable debug output
 java.lang.String defaultCharSet
          printer's default charset
 char hbLineChar
          horizontal line connected to a vertical line on the bottom
 char hLineChar
          horizontal line character (for line printing).
 char htLineChar
          horizontal line connected to a vertical line on the top
 java.lang.String linesCharSet
          character set used to draw lines.
 boolean performCharSetConversion
          convert unicode to the printers char set
 char tlCornerChar
          top left corner character (for line printing).
 char trCornerChar
          top right corner character (for line printing).
 char vLineChar
          vertical line character (for line printing).
 char vlLineChar
          vertical line connected to a horizontal line on the left size
 char vrLineChar
          vertical line connected to a horizontal line on the right size
 
Constructor Summary
TextPrinter()
           
 
Method Summary
 void endJob()
          finishes printing job
 int getBufferSize()
          size of buffer, bytes will be sent to the port only when the buffer is full
 JobProperties getDefaultJobProperties()
          create default printer job
 TextProperties getDefaultTextProperties()
          create default text properties
 java.lang.String[] getFirstElements(java.lang.String[][] t)
          get list of first element in array
 java.util.Enumeration getSupportedCharPitch()
          get list of supported fonts sizes
 java.lang.String[] getSupportedCharSets()
          get list of supported char sets
 java.util.Enumeration getSupportedFonts()
          get list of supported fonts
 java.util.Enumeration getSupportedInterspaing()
          get list of supported interspacing
 void newLine()
          new line
 void newPage()
          new page
 void printArray(java.lang.String[] t)
          print array in standard output
 void printHorizontalLine(int row, int col1, int col2)
          print a horizontal line
 void printRectangle(int x1, int y1, int x2, int y2)
          print a rectangle.
 void printString(java.lang.String s)
          print at the current position using the default text properties object
 void printString(java.lang.String s, java.awt.Font font)
          print at the current position using a java.awt.Font as TextProperties substitute
 void printString(java.lang.String s, int row, int col, java.awt.Font font)
          print at the given position using a java.awt.Font as TextProperties substitute
 void printString(java.lang.String s, int row, int col, TextProperties t)
          print at the given position using the text properties object
 void printString(java.lang.String s, TextProperties t)
          print at the current position using the text properties object
 void printVerticalLine(int col, int row1, int row2)
          print a vertical line
 void setBufferSize(int s)
          size of buffer, bytes will be sent to the port only when the buffer is full
 void setLFafterCR(boolean b)
          Some printers need a line feed after every carriage return, other don't
 void startJob(PrinterPort p, JobProperties prop)
          start printing job
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hLineChar

public char hLineChar
horizontal line character (for line printing).


vLineChar

public char vLineChar
vertical line character (for line printing).


vrLineChar

public char vrLineChar
vertical line connected to a horizontal line on the right size


vlLineChar

public char vlLineChar
vertical line connected to a horizontal line on the left size


htLineChar

public char htLineChar
horizontal line connected to a vertical line on the top


hbLineChar

public char hbLineChar
horizontal line connected to a vertical line on the bottom


crossLineChar

public char crossLineChar
crossing lines characters


tlCornerChar

public char tlCornerChar
top left corner character (for line printing).


trCornerChar

public char trCornerChar
top right corner character (for line printing).


blCornerChar

public char blCornerChar
bottom left corner character (for line printing).


brCornerChar

public char brCornerChar
bottom right corner character (for line printing).


linesCharSet

public java.lang.String linesCharSet
character set used to draw lines. If null it uses the current set (for line printing).


performCharSetConversion

public boolean performCharSetConversion
convert unicode to the printers char set


defaultCharSet

public java.lang.String defaultCharSet
printer's default charset


debug

public boolean debug
enable debug output


calculatePitchAndHMI

public boolean calculatePitchAndHMI
calculate character size based on the desired number of columns?


calculateLineSpacing

public boolean calculateLineSpacing
calculate line spacing based on the number of lines in the page

Constructor Detail

TextPrinter

public TextPrinter()
Method Detail

setBufferSize

public void setBufferSize(int s)
size of buffer, bytes will be sent to the port only when the buffer is full


getBufferSize

public int getBufferSize()
size of buffer, bytes will be sent to the port only when the buffer is full


setLFafterCR

public void setLFafterCR(boolean b)
Some printers need a line feed after every carriage return, other don't


printString

public void printString(java.lang.String s,
                        int row,
                        int col,
                        TextProperties t)
print at the given position using the text properties object


printString

public void printString(java.lang.String s,
                        int row,
                        int col,
                        java.awt.Font font)
print at the given position using a java.awt.Font as TextProperties substitute


newLine

public void newLine()
             throws TextPrinterException
new line

TextPrinterException

newPage

public void newPage()
             throws TextPrinterException
new page

TextPrinterException

printHorizontalLine

public void printHorizontalLine(int row,
                                int col1,
                                int col2)
print a horizontal line


printVerticalLine

public void printVerticalLine(int col,
                              int row1,
                              int row2)
print a vertical line


printRectangle

public void printRectangle(int x1,
                           int y1,
                           int x2,
                           int y2)
print a rectangle.


printString

public void printString(java.lang.String s)
                 throws TextPrinterException
print at the current position using the default text properties object

TextPrinterException

printString

public void printString(java.lang.String s,
                        TextProperties t)
                 throws TextPrinterException
print at the current position using the text properties object

TextPrinterException

printString

public void printString(java.lang.String s,
                        java.awt.Font font)
                 throws TextPrinterException
print at the current position using a java.awt.Font as TextProperties substitute

TextPrinterException

startJob

public void startJob(PrinterPort p,
                     JobProperties prop)
              throws TextPrinterException
start printing job

TextPrinterException

endJob

public void endJob()
            throws TextPrinterException
finishes printing job

TextPrinterException

getSupportedCharSets

public java.lang.String[] getSupportedCharSets()
get list of supported char sets


getFirstElements

public java.lang.String[] getFirstElements(java.lang.String[][] t)
get list of first element in array


getSupportedFonts

public java.util.Enumeration getSupportedFonts()
get list of supported fonts


getSupportedCharPitch

public java.util.Enumeration getSupportedCharPitch()
get list of supported fonts sizes


getSupportedInterspaing

public java.util.Enumeration getSupportedInterspaing()
get list of supported interspacing


printArray

public void printArray(java.lang.String[] t)
print array in standard output


getDefaultJobProperties

public JobProperties getDefaultJobProperties()
create default printer job


getDefaultTextProperties

public TextProperties getDefaultTextProperties()
create default text properties