Class PlainTextPage
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.output.pageable.plaintext.driver.PlainTextPage
-
public class PlainTextPage extends Object
The plain text page is used to buffer a complete page and to write the buffered data when the page is closed.- Author:
- Thomas Morgner
-
-
Constructor Summary
Constructors Constructor Description PlainTextPage(Paper pageFormat, PrinterDriver driver, String defaultEncoding)
Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
PlainTextPage
public PlainTextPage(Paper pageFormat, PrinterDriver driver, String defaultEncoding)
Creates a new PlainTextPage with the given dimensions and the specified PrinterCommandSet.- Parameters:
driver
- the command-set for printing and formatting the text.
-
-
Method Detail
-
correctedDivisionFloor
public static int correctedDivisionFloor(double c, double d)
Fixes some floating point errors when calculating positions.- Parameters:
c
- the divisord
- the dividend- Returns:
- the corrected division result.
-
getWidth
public int getWidth()
Returns the page width in characters.- Returns:
- the page width.
-
getHeight
public int getHeight()
Returns the page height in lines.- Returns:
- the page height.
-
addTextChunk
public void addTextChunk(int x, int y, int w, String text, StyleSheet format)
Adds a new text chunk to this PlainTextPage. A chunk consists of a single line of text.- Parameters:
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.
-
writePage
public void writePage() throws IOException
Writes the contents of the page using the printer command set.- Throws:
IOException
- if an I/O error occured while writing the page.
-
-