public class PlainTextPage extends Object
Constructor and Description |
---|
PlainTextPage(Paper pageFormat,
PrinterDriver driver,
String defaultEncoding)
Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.
|
Modifier and Type | Method and Description |
---|---|
void |
addTextChunk(int x,
int y,
int w,
String text,
StyleSheet format)
Adds a new text chunk to this PlainTextPage.
|
static int |
correctedDivisionFloor(double c,
double d)
Fixes some floating point errors when calculating positions.
|
int |
getHeight()
Returns the page height in lines.
|
int |
getWidth()
Returns the page width in characters.
|
void |
writePage()
Writes the contents of the page using the printer command set.
|
public PlainTextPage(Paper pageFormat, PrinterDriver driver, String defaultEncoding)
driver
- the command-set for printing and formatting the text.public static int correctedDivisionFloor(double c, double d)
c
- the divisord
- the dividendpublic int getWidth()
public int getHeight()
public void addTextChunk(int x, int y, int w, String text, StyleSheet format)
x
- the column of the first character of the texty
- the row where to print the textw
- the number of characters to print.text
- the text that should be printed.format
- the font definition used to format the text.public void writePage() throws IOException
IOException
- if an I/O error occured while writing the page.