org.gerhardb.lib.print
Class PrintableBase
java.lang.Object
org.gerhardb.lib.print.PrintableBase
- All Implemented Interfaces:
- java.awt.print.Pageable, java.awt.print.Printable, MediaPageable
- Direct Known Subclasses:
- PageableImage
public abstract class PrintableBase
- extends java.lang.Object
- implements java.awt.print.Printable, java.awt.print.Pageable, MediaPageable
PrintableBase
| Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PAGE_INDEX
public static final java.lang.String PAGE_INDEX
- See Also:
- Constant Field Values
PAGE_COUNT
public static final java.lang.String PAGE_COUNT
- See Also:
- Constant Field Values
DEFAULT_FOOTER
public static final java.lang.String DEFAULT_FOOTER
myPBO
protected PBO myPBO
centerX
protected double centerX
centerY
protected double centerY
myLeftMargin
protected double myLeftMargin
myRightMargin
protected double myRightMargin
myTopMargin
protected double myTopMargin
myBottomMargin
protected double myBottomMargin
myTopPictureMargin
protected double myTopPictureMargin
myBottomPictureMargin
protected double myBottomPictureMargin
myPriorPageIndex
protected int myPriorPageIndex
myNumberOfPages
protected int myNumberOfPages
myStroke
protected java.awt.BasicStroke myStroke
myDashed
protected java.awt.BasicStroke myDashed
fontTheta
protected float fontTheta
myFontRenderContext
protected java.awt.font.FontRenderContext myFontRenderContext
myBuffGraphics
protected java.awt.Graphics2D myBuffGraphics
PrintableBase
public PrintableBase(PBO pbo)
PrintableBase
public PrintableBase(java.lang.String header)
imprint
public void imprint(PrintableBase that)
getNumberOfPages
public int getNumberOfPages()
- Count from 1. So a one page document will return 1.
- Specified by:
getNumberOfPages in interface java.awt.print.Pageable- Specified by:
getNumberOfPages in interface MediaPageable
getPrintable
public java.awt.print.Printable getPrintable(int pageIndex)
- Specified by:
getPrintable in interface java.awt.print.Pageable
getPageFormat
public java.awt.print.PageFormat getPageFormat(int pageIndex)
- Specified by:
getPageFormat in interface java.awt.print.Pageable- Specified by:
getPageFormat in interface MediaPageable
print
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
- Specified by:
print in interface java.awt.print.Printable
- Throws:
java.awt.print.PrinterException
getDoc
public javax.print.Doc getDoc(MediaFormat mediaFormat,
int pageIndex)
throws java.io.IOException
- Specified by:
getDoc in interface MediaPageable
- Throws:
java.io.IOException
print
public boolean print(java.awt.Graphics2D g2,
MediaFormat mediaFormat,
int pageIndex,
boolean buffer)
throws java.awt.print.PrinterException
- Throws:
java.awt.print.PrinterException
setPageFormat
public void setPageFormat(java.awt.print.PageFormat pf)
- Specified by:
setPageFormat in interface MediaPageable
convert
public java.lang.String convert(java.lang.String text,
int pageIndex)
getMediaFormat
protected MediaFormat getMediaFormat()
scaleDPI
public int scaleDPI(int dpi)
scaleDPI
protected float scaleDPI(float dpi)
makeCopy
public abstract PrintableBase makeCopy()
drawPage
protected abstract void drawPage(int pageIndex)
throws java.awt.print.PrinterException
- This is what you override!
- Parameters:
pageFormat -
- Throws:
java.awt.print.PrinterException
getFont
protected java.awt.Font getFont(java.lang.String fontFamily,
int size,
float theta)
showDebug
protected void showDebug()
drawTestPage
protected void drawTestPage()
Copyright ? 2007 Gerhard Beck. All rights reserved. Subject to GPL.