org.PingOO.DLAI.lib.util
Class PrinterManager

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.util.PrinterManager

public final class PrinterManager
extends java.lang.Object
implements java.lang.Runnable

Class that manages printing operations.
You can directly send text to printing or provide a Printable object that will handle all rendering operations.

Warning! Actually under Linux this seems to provoke a problem when printing plain text or when drawing text in graphics : on some system the printed pages are empty as well as the PostScript files. This may be realated to a missing font or something else.
Had also a problem sometimes when two (or more) different documents are sent to the printer, the second is never printed and the thread is still marked as active.

Warning! Hada problem under windows with Epson Stylus Color 800, if the generic windows driver is in use instead of the Epson's one then only the first page of the document is printed.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
Runnable, Printable, java.awt.print.PrinterJob

Field Summary
private  java.awt.print.Printable printable
          The current Printable object that will be used when printing.
private  PThread printerThread
          The thread use to print.
 
Constructor Summary
private PrinterManager(java.awt.print.Printable printable)
          Creates a new PrinterManager.
 
Method Summary
static void print(java.awt.print.Printable printable)
          Launches a new printing session using the Printable object.
static void print(java.lang.String text)
          Prints a text.
 void run()
          Do printing job.
private  void start()
          Start printing operations.
 void stop()
          Stops the current PrinterManager.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

printerThread

private PThread printerThread
The thread use to print.

printable

private java.awt.print.Printable printable
The current Printable object that will be used when printing.
Constructor Detail

PrinterManager

private PrinterManager(java.awt.print.Printable printable)
Creates a new PrinterManager.
Parameters:
printable - The printable object to use.
Method Detail

print

public static final void print(java.awt.print.Printable printable)
Launches a new printing session using the Printable object.
The Printable object will do the job of correctly rendering what's needed to be printed.
Parameters:
printable - The Printable object to use.

print

public static final void print(java.lang.String text)
Prints a text.
Parameters:
printable - The text to be printed.

start

private void start()
Start printing operations.

run

public void run()
Do printing job.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops the current PrinterManager.