|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jrefinery.report.targets.pageable.output.PrinterCommandSet
Implements a printer command set for plain text output. The output is not enriched with any printer specific control sequences.
Field Summary | |
static byte |
CARRIAGE_RETURN
the Carriage Return control character, the printer carriage returns to the start of the line. |
static byte |
FORM_FEED
the form feed character, ejects the current page and starts the next page. |
static byte |
LINE_FEED
scrolls the paper up a single line. |
static byte |
SELECT_FONT_COURIER
the courier font. |
static byte |
SELECT_FONT_FROM_MENU
selects the font, which is selected on the printer menu. |
static byte |
SELECT_FONT_GOTHIC
the gothic font. |
static byte |
SELECT_FONT_OCR_A
the OCR-A font. |
static byte |
SELECT_FONT_OCR_B
the OCR-B font. |
static byte |
SELECT_FONT_ORATOR
the orator font. |
static byte |
SELECT_FONT_PRESTIGE
the prestige font. |
static byte |
SELECT_FONT_ROMAN
the roman font. |
static byte |
SELECT_FONT_SWISS
the swiss font. |
static byte |
SELECT_FONT_SWISS_BOLD
the swiss-bold font. |
static byte |
SPACE
the space character. |
Constructor Summary | |
PrinterCommandSet(java.io.OutputStream out,
java.awt.print.PageFormat format,
int defaultCPI,
int defaultLPI)
Creates a new PrinterCommandSet. |
Method Summary | |
void |
endLine()
Ends a new line. |
void |
endPage()
Ends the current page. |
void |
flush()
Flushes the output stream. |
int |
getBorderBottom()
Returns the bottom border in lines. |
int |
getBorderLeft()
Returns the left border in characters. |
int |
getBorderRight()
Returns the right border in characters. |
int |
getBorderTop()
Returns the top border in lines. |
byte |
getCharacterWidth()
Gets the character width in CPI. |
java.lang.String |
getCodepage()
Returns the current codepage of the printer. |
int |
getDefaultCPI()
Gets the default character width in CPI. |
int |
getDefaultLPI()
Gets the default character height in CPI. |
byte |
getFont()
Returns the defined font selection byte. |
int |
getLineSpacing()
Returns the line spacing for the printer, the spacing is given in 1/1440 inches. |
protected java.io.OutputStream |
getOut()
Gets the outputstream that is used to write the generated content. |
java.awt.print.PageFormat |
getPageFormat()
Gets the pageformat used in this command set. |
int |
getPaperSize()
Returns the paper size in lines. |
boolean |
isAutoLf()
Gets the AutoLF flag. |
boolean |
isBold()
Gets the bold format flag. |
boolean |
isEncodingSupported(java.lang.String encoding)
Tests whether the given encoding is supported. |
boolean |
isItalic()
Gets the italic format flag. |
boolean |
isLetterQuality()
Gets the letter quality flag. |
boolean |
isStrikethrough()
Gets the strikethrough format flag. |
boolean |
isUnderline()
Gets the underline format flag. |
void |
printChunk(PlainTextPage.TextDataChunk chunk,
int x)
Prints a single text chunk. |
void |
printEmptyChunk()
Prints an empty chunk. |
void |
resetPrinter()
Resets the printer to the default values. |
void |
setAutoLF(boolean autoLF)
Defines whether to print in AutoLF mode. |
void |
setCharacterWidth(byte charWidth)
Defines the character width for the current font. |
void |
setCodePage(java.lang.String codepage)
Defines the code page for the text to be printed. |
void |
setFont(byte fontSelection)
Defines the font. |
void |
setFontStyle(boolean bold,
boolean italic,
boolean underline,
boolean strike)
Defines the font style for the printed text. |
void |
setHorizontalBorder(int left,
int right)
Defines the horizontal borders for the current paper. |
void |
setLineSpacing(int spaceInInch)
Defines the line spacing for the printer, the spacing is given in 1/1440 inches. |
void |
setPaperSize(int lines)
Defines the papersize in lines. |
void |
setPrintQuality(boolean letterQuality)
Defines the printing quality for the printed text. |
void |
setVerticalBorder(int top,
int bottom)
Defines the horizontal borders for the current paper. |
void |
startLine()
Starts a new line. |
void |
startPage()
Starts the current page. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte SELECT_FONT_ROMAN
public static final byte SELECT_FONT_SWISS
public static final byte SELECT_FONT_COURIER
public static final byte SELECT_FONT_PRESTIGE
public static final byte SELECT_FONT_OCR_A
public static final byte SELECT_FONT_OCR_B
public static final byte SELECT_FONT_ORATOR
public static final byte SELECT_FONT_SWISS_BOLD
public static final byte SELECT_FONT_GOTHIC
public static final byte SELECT_FONT_FROM_MENU
public static final byte CARRIAGE_RETURN
public static final byte LINE_FEED
public static final byte FORM_FEED
public static final byte SPACE
Constructor Detail |
public PrinterCommandSet(java.io.OutputStream out, java.awt.print.PageFormat format, int defaultCPI, int defaultLPI)
out
- the target output streamformat
- the pageformat of the used reportdefaultCPI
- the characters-per-inch for the output.defaultLPI
- the lines-per-inch for the output.Method Detail |
public java.awt.print.PageFormat getPageFormat()
public int getDefaultCPI()
public int getDefaultLPI()
protected java.io.OutputStream getOut()
public void setFont(byte fontSelection) throws java.io.IOException
fontSelection
- the font selection byte.
java.io.IOException
- is not thrown here.public byte getFont()
public void setCharacterWidth(byte charWidth) throws java.io.IOException
charWidth
- the character width in CPI.
java.io.IOException
- if there was an IOError while writing the command or if the
character width is not supported by the printer.public byte getCharacterWidth()
public void setFontStyle(boolean bold, boolean italic, boolean underline, boolean strike) throws java.io.IOException
bold
- true, if the text should be printed in bold mode.italic
- true, if the text should be italic, false otherwiseunderline
- true, if the text should be underlined, false otherwisestrike
- true, if the text should be strikethrough, false otherwise
java.io.IOException
- if there was an IOError while writing the commandpublic boolean isStrikethrough()
public boolean isUnderline()
public boolean isItalic()
public boolean isBold()
public void setPaperSize(int lines) throws java.io.IOException
lines
- the number of lines that could be printed on a single page.
java.io.IOException
- if there was an IOError while writing the commandpublic int getPaperSize()
public void setHorizontalBorder(int left, int right) throws java.io.IOException
left
- the number of spaces printed on the start of a line.right
- the number of spaces left free on the right paper border.
java.io.IOException
- if an IOException occured while updating the printer state.public void setVerticalBorder(int top, int bottom) throws java.io.IOException
top
- the number of blank lines printed on the start of a page.bottom
- the number of blank lines printed at the end of a page
java.io.IOException
- if an IOException occured while updating the printer state.public int getBorderBottom()
public int getBorderTop()
public int getBorderRight()
public int getBorderLeft()
public void setLineSpacing(int spaceInInch) throws java.io.IOException
spaceInInch
- the linespacing in 1/1440 inches.
java.io.IOException
- if an IOException occured while updating the printer state.public int getLineSpacing()
public void setCodePage(java.lang.String codepage) throws java.io.IOException
codepage
- the new codepage that should be used.
java.io.IOException
- if there was an IOError while writing the commandpublic java.lang.String getCodepage()
public void setAutoLF(boolean autoLF) throws java.io.IOException
autoLF
- the new autoLF state
java.io.IOException
- if there was an IOError while writing the commandpublic void setPrintQuality(boolean letterQuality) throws java.io.IOException
letterQuality
- true, if letter quality should be used, false for draft-quality
java.io.IOException
- if there was an IOError while writing the commandpublic boolean isLetterQuality()
public boolean isAutoLf()
public void resetPrinter() throws java.io.IOException
java.io.IOException
- if there was an IOError while writing the commandpublic void startPage() throws java.io.IOException
java.io.IOException
- if there was an IOError while writing the commandpublic void endPage() throws java.io.IOException
java.io.IOException
- if there was an IOError while writing the commandpublic void startLine() throws java.io.IOException
java.io.IOException
- if an IOError occures.public void endLine() throws java.io.IOException
java.io.IOException
- if an IOError occures.public void printChunk(PlainTextPage.TextDataChunk chunk, int x) throws java.io.IOException
chunk
- the chunk that should be writtenx
- the column where to start to print the chunk
java.io.IOException
- if an IO error occured.public void printEmptyChunk() throws java.io.IOException
java.io.IOException
- if an IOError occured.public void flush() throws java.io.IOException
java.io.IOException
- if an IOError occured.public boolean isEncodingSupported(java.lang.String encoding)
encoding
- the encoding that should be tested.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |