ach.image
Class PrintImage
java.lang.Object
|
+--ach.image.PrintImage
- All Implemented Interfaces:
- java.lang.Runnable
- public class PrintImage
- extends java.lang.Object
- implements java.lang.Runnable
PrintImage.java
Copyright (c) 1998-2001 Helge Hackbarth, All Rights Reserved.
Print an image from an EMemImageSource. Generally two ways of
printing are supported:
In the first alternative an operating system dependent print
dialog will be presented to specify printer settings; afterwards
another dialog with image preview allows to set page size,
orientation, borders, image location and image size.
The second alternative allows to send the image directly to the
printer by specifying the relevant parameters and a print job
object as variables in a method call.
The process of sending image data to the printing subsystem can be
run as seperate thread. Default settings for printing can be passed
as properties (see constructor for details). When the print-dialog
is closed, the current settings are stored in the properties Hashtable.
THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY
DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
Constructor Summary |
PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.util.Hashtable props)
Constructor. |
PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.util.Hashtable props,
BatchPrinter batchPrinter)
Constructor. |
PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.awt.Rectangle printArea,
EMemImageSource imgSrc2,
java.awt.Rectangle printArea2,
java.awt.PrintJob printJob)
Constructor. |
PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.awt.Rectangle printArea,
java.awt.PrintJob printJob)
Constructor. |
Method Summary |
static void |
rPD(java.awt.PrintJob printJob)
|
static void |
rPD(java.awt.PrintJob printJob,
int prefRes)
|
void |
run()
Run printing (automatically called as separate thread by start()). |
void |
start()
Start printing as a seperate thread (calls run() automatically).
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PrintImage
public PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.util.Hashtable props)
- Constructor. Used to specify all printing relevant parameters with dialog boxes.
- Parameters:
parent
- the parent frameimgSrc
- image producer derived from EMemImageSourceprops
- Hashtable with properties (values for "PAGESIZE", "ORIENTATION",
"RESOLUTION", "LEFTMARGIN", "RIGHTMARGIN", "TOPMARGIN", "BOTTOMMARGIN");
"PAGESIZE"="Executive", "Letter", "Legal", "A4", "A3", "Tabloid", "A2", "A1", "A0";
"ORIENTATION"=true for portrait, false for landscape;
"RESOLUTION"=one of "72 dpi", "150 dpi", "300 dpi", "360 dpi", "600 dpi", "720 dpi", "1200 dpi", "1440 dpi";
"FORCEJDK11PRINTJOB"=true or false (false uses JDK12-PrinterJob);
margins specified in 1/1000 cm = 1/2540 inch
PrintImage
public PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.util.Hashtable props,
BatchPrinter batchPrinter)
- Constructor. Used to specify all printing relevant parameters with dialog boxes.
- Parameters:
parent
- the parent frameimgSrc
- image producer derived from EMemImageSourceprops
- Hashtable with properties (values for "PAGESIZE", "ORIENTATION",
"RESOLUTION", "LEFTMARGIN", "RIGHTMARGIN", "TOPMARGIN", "BOTTOMMARGIN");
"PAGESIZE"="Executive", "Letter", "Legal", "A4", "A3", "Tabloid", "A2", "A1", "A0";
"ORIENTATION"=true for portrait, false for landscape;
"RESOLUTION"=one of "72 dpi", "150 dpi", "300 dpi", "360 dpi", "600 dpi", "720 dpi", "1200 dpi", "1440 dpi";
"FORCEJDK11PRINTJOB"=true or false (false uses JDK12-PrinterJob);
margins specified in 1/1000 cm = 1/2540 inchbatchPrinter
- allows to hand over a callback method for printing a sequence of slides (see interface BatchPrinter)
PrintImage
public PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.awt.Rectangle printArea,
java.awt.PrintJob printJob)
- Constructor. Allows to print an image without further print dialogs
using a given (JDK 1.1 type) PrintJob.
- Parameters:
parent
- the parent frameimgSrc
- image producer derived from EMemImageSourceprintArea
- Rectangle to be used for printing (JDK >= 1.1.6 uses points (1/72 inch), other VMs relate to screen resolution)printJob
- print job (must be created once before and can be reused for all printouts)
PrintImage
public PrintImage(java.awt.Frame parent,
EMemImageSource imgSrc,
java.awt.Rectangle printArea,
EMemImageSource imgSrc2,
java.awt.Rectangle printArea2,
java.awt.PrintJob printJob)
- Constructor. Allows to print two overlayed images without further print dialogs.
- Parameters:
parent
- the parent frameimgSrc
- image producer of background image derived from EMemImageSourceprintArea
- Rectangle to be used for printing imgSrc (JDK >= 1.1.6 uses points (1/72 inch), other VMs relate to screen resolution)imgSrc2
- image producer of overlayed foreground image derived from EMemImageSourceprintArea2
- Rectangle to be used for printing imgSrc2 (JDK >= 1.1.6 uses points (1/72 inch), other VMs relate to screen resolution)printJob
- print job (must be created once before and can be reused for all printouts)
start
public void start()
- Start printing as a seperate thread (calls run() automatically).
If you want to print without separate thread, please call
run() method immediately.
run
public void run()
- Run printing (automatically called as separate thread by start()).
- Specified by:
run
in interface java.lang.Runnable
rPD
public static void rPD(java.awt.PrintJob printJob)
rPD
public static void rPD(java.awt.PrintJob printJob,
int prefRes)