com.crionics.jpdf
Class PrinterModule

java.lang.Object
  extended by PdfModule
      extended by com.crionics.jpdf.AbstractModule
          extended by com.crionics.jpdf.PrinterModule

public final class PrinterModule
extends AbstractModule


Field Summary
 
Fields inherited from class com.crionics.jpdf.AbstractModule
MOD_CREATOR, MOD_DESCRIPTION, MOD_ENCRYPTION, MOD_MERGER, MOD_PRINTER, MOD_SECURITY, MOD_SIGNER, MOD_TEMPLATE
 
Method Summary
 java.awt.image.BufferedImage convertToImage(int pgIdx)
          Converts a given page index to a graphical representation
 java.awt.image.BufferedImage convertToImage(int pgIdx, int dpi)
          Converts a given page index to a graphical representation
 void print()
          Prints the current document to the default printerjob. the process shows the print preference dialog and prompts for action.
 void print(java.lang.Object job)
          Prints the current document to the default printerjob. the process is silent and does NOT show the print preference dialog.
 void print(java.lang.Object job, java.lang.Object printRequestAttributeSet)
          Prints the current document to the given printerjob using attributes. the silentPrinting flag tells if the process shows the print preference dialog.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convertToImage

public java.awt.image.BufferedImage convertToImage(int pgIdx)
                                            throws PdfException,
                                                   java.io.IOException
Converts a given page index to a graphical representation

Parameters:
pgIdx - the page index to convert
Returns:
a BufferedImage which can be used to generate GIF, JPEG, PNG..etc
Throws:
PdfException - pdf generation issues
java.io.IOException - io/cache issues

convertToImage

public java.awt.image.BufferedImage convertToImage(int pgIdx,
                                                   int dpi)
                                            throws PdfException,
                                                   java.io.IOException
Converts a given page index to a graphical representation

Parameters:
pgIdx - the page index to convert
dpi - the dotperinch ratio, default 72
Returns:
a BufferedImage which can be used to generate GIF, JPEG, PNG..etc
Throws:
PdfException - pdf generation issues
java.io.IOException - io/cache issues

print

public void print()
           throws PdfException,
                  java.awt.print.PrinterException,
                  java.io.IOException
Prints the current document to the default printerjob. the process shows the print preference dialog and prompts for action.

Throws:
PdfException - pdf generation issues
java.awt.print.PrinterException - issue with the printer
java.io.IOException - io issue

print

public void print(java.lang.Object job)
           throws PdfException,
                  java.awt.print.PrinterException,
                  java.io.IOException
Prints the current document to the default printerjob. the process is silent and does NOT show the print preference dialog.

PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
attr.add(new Copies(2));
attr.add(Sides.DUPLEX); attr.add(PrintQuality.HIGH);
attr.add(SheetCollate.COLLATED);
attr.add(OrientationRequested.PORTRAIT);

Parameters:
job - either a javax.print.DocPrintJob or a java.awt.PrinterJob
Throws:
PdfException - pdf generation issues
java.awt.print.PrinterException - issue with the printer
java.io.IOException - io issue

print

public void print(java.lang.Object job,
                  java.lang.Object printRequestAttributeSet)
           throws PdfException,
                  java.awt.print.PrinterException,
                  java.io.IOException
Prints the current document to the given printerjob using attributes. the silentPrinting flag tells if the process shows the print preference dialog.

this method is typically called as follows:
print(java.awt.PrinterJob, javax.print.attribute.PrintRequestAttributeSet);
or
print(javax.print.DocPrintJob, javax.print.attribute.PrintRequestAttributeSet);

The parameters are generic to help support different JDK versions.

Parameters:
job - either a javax.print.DocPrintJob or a java.awt.PrinterJob
printRequestAttributeSet - must have type javax.print.attribute.PrintRequestAttributeSet which is only available on JDK 1.5+. It is left as an Object for backward compatibility. leave null if not used. It is used to force printer attribute properties, typically the number of copies, the page orientation and/or any special attributes supported by the printer.
Throws:
PdfException - pdf generation issues
java.awt.print.PrinterException - issue with the printer
java.io.IOException - io issue


Copyright © 1999-2007 Crionics. All Rights Reserved.