com.elixirtech.glint.print
Class GlintStreamPrinter

java.lang.Object
  extended by com.elixirtech.glint.print.GlintStreamPrinter

public class GlintStreamPrinter
extends java.lang.Object

GlintStreamPrinter will output to a printer in two modes GUI or Slient mode. In Interactive mode, a number of dialog settings are ignored because they are already fixed by the Glint data. Ideally these would not be shown, but the Java dialog doesn't give that option. The ignored values are:

The orientation shown on the dialog is the orientation of the first page in the glint. Changing it in the dialog has no effect. The margins shown on the dialog are the default for the printer. Glint is a full-page description language, and does not retain margin information after rendering.
All other print attributes - eg. page range, number of copies etc. will be applied, if supported by the chosen printer.


Constructor Summary
GlintStreamPrinter()
           
 
Method Summary
 void print(boolean interactive, java.io.InputStream is, javax.print.attribute.PrintRequestAttributeSet aset, javax.print.event.PrintJobListener pjl)
          Print API for printing a glint input stream.
 void printNonInteractive(javax.print.PrintService ps, com.elixirtech.glint.IEye eye, javax.print.attribute.PrintRequestAttributeSet aset, javax.print.event.PrintJobListener pjl)
          Print API for printing a glint Eye object with no dialog.
 void printNonInteractive(javax.print.PrintService ps, java.io.InputStream is, javax.print.attribute.PrintRequestAttributeSet aset, javax.print.event.PrintJobListener pjl)
          Print API for printing a glint input stream with no dialog.
 void setPhysicalPageSize(java.awt.Dimension physicalPageSizeOrNull)
           
 void setTargetPrinters(java.lang.String[] printers)
          Set the printer names that will be tried (in order) for non-interactive printing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlintStreamPrinter

public GlintStreamPrinter()
Method Detail

setTargetPrinters

public void setTargetPrinters(java.lang.String[] printers)
Set the printer names that will be tried (in order) for non-interactive printing. The first printer that is able to handle the requested print attributes will be used. This value is not used in interactive mode. If no value is set, or the value is either null or a zero length array, then the default printer will be used.

Parameters:
printers - An array of printer names.

setPhysicalPageSize

public void setPhysicalPageSize(java.awt.Dimension physicalPageSizeOrNull)

print

public void print(boolean interactive,
                  java.io.InputStream is,
                  javax.print.attribute.PrintRequestAttributeSet aset,
                  javax.print.event.PrintJobListener pjl)
           throws java.io.IOException,
                  javax.print.PrintException,
                  java.awt.print.PrinterException
Print API for printing a glint input stream.

Parameters:
interactive - Pass true to show a print dialog or false for silent printing
is - Glint input stream - eg. byte array stream or file input stream
aset - The desired print attributes (see J2SE(TM) Print Service API for the possible parameters)
pjl - To monitor the status of the printer job
Throws:
java.io.IOException - An error reading the Glint stream
javax.print.PrintException - An exception has occurred in the print system
java.awt.print.PrinterException - No print service found that matches the desired attributes.

printNonInteractive

public void printNonInteractive(javax.print.PrintService ps,
                                java.io.InputStream is,
                                javax.print.attribute.PrintRequestAttributeSet aset,
                                javax.print.event.PrintJobListener pjl)
                         throws java.io.IOException,
                                javax.print.PrintException
Print API for printing a glint input stream with no dialog.

Parameters:
ps - The Print service.
is - Glint input stream - eg. byte array stream or file input stream
aset - The desired print attributes (see J2SE(TM) Print Service API for the possible parameters)
pjl - To monitor the status of the printer job
Throws:
java.io.IOException - An error reading the Glint stream
javax.print.PrintException - An exception has occurred in the print system

printNonInteractive

public void printNonInteractive(javax.print.PrintService ps,
                                com.elixirtech.glint.IEye eye,
                                javax.print.attribute.PrintRequestAttributeSet aset,
                                javax.print.event.PrintJobListener pjl)
                         throws java.io.IOException,
                                javax.print.PrintException
Print API for printing a glint Eye object with no dialog.

Parameters:
ps - The Print service.
eye - The IEye (glint) object
aset - The desired print attributes (see J2SE(TM) Print Service API for the possible parameters)
pjl - To monitor the status of the printer job
Throws:
java.io.IOException - An error reading the Glint stream
javax.print.PrintException - An exception has occurred in the print system