Class AbstractEpsonPrinterDriver
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.output.pageable.plaintext.driver.AbstractEpsonPrinterDriver
-
- All Implemented Interfaces:
PrinterDriver
- Direct Known Subclasses:
Epson24PinPrinterDriver
,Epson9PinPrinterDriver
public abstract class AbstractEpsonPrinterDriver extends Object implements PrinterDriver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractEpsonPrinterDriver.DriverState
-
Field Summary
Fields Modifier and Type Field Description static String
FONT_15_CPI
static String
OP_NO_ASSIGN_CHAR_TABLE
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEpsonPrinterDriver(OutputStream out, float charsPerInch, float linesPerInch, String printerModel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
endLine(boolean overflow)
Ends a new line.void
endPage(boolean overflow)
Ends the current page.void
flush()
Flushes the output stream.float
getCharactersPerInch()
Gets the default character width in CPI.AbstractEpsonPrinterDriver.DriverState
getDriverState()
protected EncodingUtilities
getEncodingUtilities(String encoding)
byte
getFallBackCharset()
FontMapper
getFontMapper()
float
getLinesPerInch()
Gets the default line height.protected OutputStream
getOut()
PrinterSpecification
getPrinterSpecification()
protected abstract PrinterSpecificationManager
getPrinterSpecificationManager()
protected boolean
isFirstPage()
void
printChunk(PlaintextDataChunk chunk)
Prints a single text chunk at the given position on the current line.void
printEmptyChunk(int count)
Prints an empty chunk.void
printRaw(byte[] raw)
Prints some raw content.protected void
sendDefineCharacterWidth(float charactersPerInch)
protected void
sendDefineCodepage(String encoding, int characterTable)
protected void
sendDefineFont(byte printerFont)
protected void
sendDefineHorizontalBorders(int left, int right)
protected abstract void
sendDefineLineSpacing(float lineHeightInPoints)
protected void
sendDefinePageLengthInLines(int paperSizeInLines)
protected void
sendDefineUserCharacters()
protected abstract void
sendFontStyle(boolean bold, boolean italic, boolean underline, boolean strikeTrough)
protected void
sendResetPrinter()
void
setFallBackCharset(byte fallBackCharset)
void
setFontMapper(FontMapper fontMapper)
void
startLine()
Starts a new line.void
startPage(Paper paper, String encoding)
Resets the printer and starts a new page.
-
-
-
Field Detail
-
OP_NO_ASSIGN_CHAR_TABLE
public static final String OP_NO_ASSIGN_CHAR_TABLE
- See Also:
- Constant Field Values
-
FONT_15_CPI
public static final String FONT_15_CPI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractEpsonPrinterDriver
protected AbstractEpsonPrinterDriver(OutputStream out, float charsPerInch, float linesPerInch, String printerModel)
-
-
Method Detail
-
getDriverState
public AbstractEpsonPrinterDriver.DriverState getDriverState()
-
getFontMapper
public FontMapper getFontMapper()
-
setFontMapper
public void setFontMapper(FontMapper fontMapper)
-
getOut
protected OutputStream getOut()
-
isFirstPage
protected boolean isFirstPage()
-
getPrinterSpecification
public PrinterSpecification getPrinterSpecification()
-
endLine
public void endLine(boolean overflow) throws IOException
Ends a new line.- Specified by:
endLine
in interfacePrinterDriver
- Parameters:
overflow
-- Throws:
IOException
- if an IOError occures.
-
endPage
public void endPage(boolean overflow) throws IOException
Ends the current page. Should print empty lines or an FORM_FEED command.- Specified by:
endPage
in interfacePrinterDriver
- Parameters:
overflow
-- Throws:
IOException
- if there was an IOError while writing the command
-
getCharactersPerInch
public float getCharactersPerInch()
Gets the default character width in CPI.- Specified by:
getCharactersPerInch
in interfacePrinterDriver
- Returns:
- the default character width in CPI.
-
getLinesPerInch
public float getLinesPerInch()
Gets the default line height.- Specified by:
getLinesPerInch
in interfacePrinterDriver
- Returns:
- the default line height.
-
flush
public void flush() throws IOException
Flushes the output stream.- Specified by:
flush
in interfacePrinterDriver
- Throws:
IOException
- if an IOError occured.
-
printChunk
public void printChunk(PlaintextDataChunk chunk) throws IOException
Prints a single text chunk at the given position on the current line. The chunk should not be printed, if an previous chunk overlays this chunk.- Specified by:
printChunk
in interfacePrinterDriver
- Parameters:
chunk
- the chunk that should be written- Throws:
IOException
- if an IO error occured.
-
sendFontStyle
protected abstract void sendFontStyle(boolean bold, boolean italic, boolean underline, boolean strikeTrough) throws IOException
- Throws:
IOException
-
sendDefineFont
protected void sendDefineFont(byte printerFont) throws IOException
- Throws:
IOException
-
printEmptyChunk
public void printEmptyChunk(int count) throws IOException
Prints an empty chunk. This is called for all undefined chunk-cells. The last defined font is used to print that empty text.- Specified by:
printEmptyChunk
in interfacePrinterDriver
- Throws:
IOException
- if an IOError occured.
-
printRaw
public void printRaw(byte[] raw) throws IOException
Prints some raw content. This content is not processed in any way, so be very carefull.- Specified by:
printRaw
in interfacePrinterDriver
- Parameters:
raw
- the content that should be printed.- Throws:
IOException
-
startLine
public void startLine() throws IOException
Starts a new line.- Specified by:
startLine
in interfacePrinterDriver
- Throws:
IOException
- if an IOError occures.
-
startPage
public void startPage(Paper paper, String encoding) throws IOException
Resets the printer and starts a new page. Prints the top border lines (if necessary).- Specified by:
startPage
in interfacePrinterDriver
- Throws:
IOException
- if there was an IOError while writing the command
-
sendDefineCharacterWidth
protected void sendDefineCharacterWidth(float charactersPerInch) throws IOException
- Throws:
IOException
-
sendResetPrinter
protected void sendResetPrinter() throws IOException
- Throws:
IOException
-
sendDefineLineSpacing
protected abstract void sendDefineLineSpacing(float lineHeightInPoints) throws IOException
- Throws:
IOException
-
sendDefinePageLengthInLines
protected void sendDefinePageLengthInLines(int paperSizeInLines) throws IOException
- Throws:
IOException
-
sendDefineHorizontalBorders
protected void sendDefineHorizontalBorders(int left, int right) throws IOException
- Throws:
IOException
-
sendDefineCodepage
protected void sendDefineCodepage(String encoding, int characterTable) throws IOException
- Throws:
IOException
-
sendDefineUserCharacters
protected void sendDefineUserCharacters()
-
getEncodingUtilities
protected EncodingUtilities getEncodingUtilities(String encoding) throws IOException
- Throws:
IOException
-
getPrinterSpecificationManager
protected abstract PrinterSpecificationManager getPrinterSpecificationManager()
-
getFallBackCharset
public byte getFallBackCharset()
-
setFallBackCharset
public void setFallBackCharset(byte fallBackCharset)
-
-