ach.image
Class TilePrintable
- public class TilePrintable
- extends Object
- implements Printable
- TilePrintable.java
Copyright (c) 2002 Helge Hackbarth, All Rights Reserved.
Printable implementation to meet Tiffy PrintImage requirements for Java 2 (JDK 1.2 and higher). This class is able to print an image across several pages if printArea's width or height is bigger than PageFormat. Some methods use generic object parameters instead of classes in order to be able to be compiled into applications that may not make use of Java 2 classes.
- Version:
- 3.0
- Author:
- Helge Hackbarth
TilePrintable
public TilePrintable(Image img,
int iWidth,
int iHeight,
Dimension printDimension,
Hashtable props)
- Constructor. Used to set image to be printed with print method
- Parameters:
img
- specifying the image to be printed
iWidth
- specifying the width of the image in pixels
iHeight
- specifying the height of the image in pixels
printDimension
- width and height of image in print units (72 dpi)
props
- a hashtable containing additional properties, e.g. annotations
TilePrintable
public TilePrintable()
- Constructor. Another call to setImage will be required before printing.
setImage
public void setImage(Image img,
int iWidth,
int iHeight,
Dimension printDimension,
Hashtable props)
- Used to set or change image to be printed with print method
- Parameters:
img
- specifying the image to be printed
iWidth
- specifying the width of the image in pixels
iHeight
- specifying the height of the image in pixels
printDimension
- width and height of image in print units (72 dpi)
props
- a hashtable containing additional properties, e.g. annotations
calcPages
public int calcPages(PageFormat pageFormat)
- calculate number of columns and number of rows if printout has to be tiled across pages
- Parameters:
pageFormat
- specifying the page and the printable area
- Returns:
- number of pages to be printed in total
print
public int print(Graphics pg,
PageFormat pageFormat,
int pageIndex)
- Used to print a page (that may be printed across several physical sheets)
- Parameters:
pg
- the print graphics
pageFormat
- specifying the page and the printable area
pageIndex
- specifying the current page index if image is printed across several sheets