Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone
Class PdfPrinter

java.lang.Object
  extended bycom.gnostice.pdfone.PdfPrinter
All Implemented Interfaces:
Printable, Serializable

public class PdfPrinter
extends Object
implements Serializable, Printable

This class represents the printer component of PDFOne Java. To print a PDF document:

  1. load the document,
  2. select a printer, and
  3. give the print command.
import com.gnostice.pdfone.PdfPrinter;

public class PdfPrinter_Example {
  public static void main(String[] args) {

    try {
      // Create a printer object
      PdfPrinter prn = new PdfPrinter();

      // Load a document
      prn.loadDocument("sample_doc.pdf");

      // Get a list of printers
      String sPrinters[] = prn.getAvailablePrinterNames();

      // If there are any printers
      if (sPrinters.length > 0) {
        // Select the first printer
        prn.setSelectedPrinterName(sPrinters[0]);
        // Print a print range for just once
        prn.print("1,3-4", 1);
      }      

      // Close document
      prn.closeDocument();

    } catch (Exception e) {
      System.out.println("Sorry, an error occurred - " + e.getMessage()); 
    }

  }  
}

IMPORTANT: Avoid using measurement units from PdfMeasurement. Instead, use the measurement unit constants from this class - MU_INCHES, MU_MM and MU_POINTS.

This printer component contains a built-in print dialog box, which can be used to obtain print settings and print command from the end-user.

See Also:
PdfPrintPageHandler, Serialized Form

Field Summary
static int MU_INCHES
          Constant for page measurement unit in inches.
static int MU_MM
          Constant for page measurement unit in millimetres.
static int MU_POINTS
          Constant for page measurement unit in points.
static int Orientation_LANDSCAPE
          Constant for landscape printer page orientation.
static int Orientation_PORTRAIT
          Constant for portrait printer page orientation.
static int SCALE_FIT_TO_PRINTER_MARGINS
          Constant for specifying that document pages need to be resized to exactly fit within printer page margins.
static int SCALE_NONE
          Constant for specifying that document pages need to be printed as is, without any resizing.
static int SCALE_REDUCE_TO_PRINTER_MARGINS
          Constant for specifying that document pages need to down-sized to be accommodated within the margins of printer page margins but only when the document page is bigger than the printer page.
static int SUBSET_EVEN_ONLY
          Constant for specifying only even pages as the print range subset.
static int SUBSET_NONE
          Constant for specifying all pages as the print range subset.
static int SUBSET_ODD_ONLY
          Constant for specifying only odd pages as the print range subset.
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PdfPrinter()
           
PdfPrinter(PdfDocument d)
          Deprecated. Instead use a load method or the setDocument(PdfDocument) method. Constructs a PdfPrinter object with specified PdfDocument object.
 
Method Summary
 void autoRotateandCenter(boolean autoRotateandCenter)
          Specifies whether rotated pages in the document need to be rotated and centered when they are printed.
 void closeDocument()
          Closes the loaded document.
 String[] getAvailablePrinterNames()
          Returns names of all printers available for printing.
 int getCopies()
          Returns number of copies for the print job.
 String getDefaultPrinterName()
          Returns name of default printer to which this printer object to will print.
 PdfDocument getDocument()
          Returns the PdfDocument object that has been set up with this printer object.
 Finishings getFinishings()
          Returns finishing operations that are set to be performed for the current print job.
 int getOrientation()
          Returns default printer page orientation.
 double[] getPageDimension()
          Returns dimensions of default page size of the printer.
 double[] getPageDimension(int inMeasurementUnit)
          Returns dimensions of default page size of the printer, in specified measurement unit.
 double[] getPageMargins()
          Returns page margins in default measurement units.
 double[] getPageMargins(int inMeasurementUnit)
          Returns page margins in specified measurement unit.
 String getPageRange()
          Returns page range of the next print job.
 int getPageScale()
          Returns how pages will be resized for the next print job.
 int getPageSize()
          Returns size of the pages for the next print job.
 PdfPrintHandler getPdfPrintHandler()
           
 Chromaticity getPrintChromaticity()
           
 String getPrintJobName()
          Returns name specified for the next print job.
 MediaTray getPrintMediaTray()
          Returns current paper source or tray.
 PdfPrintPageHandler getPrintPageHandler()
           
 SheetCollate getPrintSheetCollate()
          Returns how print output is collated when multiple copies of the document is printed.
 Sides getPrintSides()
          Returns how pages from a print job are imposed on the sides of the output media (paper).
 String getPrintToFileName()
          Returns pathname of the file to which printer has been set to print.
 PdfRenderErrorHandler getRenderErrorHandler()
           
 String getSelectedPrinterName()
          Returns name of the selected printer for the next print job.
 int getSubset()
          Returns print range subset of the next print job.
 boolean isAutoRotateandCenter()
          Returns whether rotated pages in the document aer set to be rotated and centered when they are printed.
static boolean isFontProcessorLibraryLoaded()
          Deprecated. no replacement
 boolean isPrintToFile()
          Specifies whether printer is set to print to a file.
 boolean isReverse()
          Returns whether all pages are set for being printed in reverse order.
 void loadDocument(byte[] byteArray)
          Loads document contained in a specified byte array for printing.
 void loadDocument(byte[] byteArray, String password)
          Loads encrypted document in specfied array with specified password.
 void loadDocument(File inFile)
          Loads document specified by a File object.
 void loadDocument(FileInputStream fileInputStream)
          Loads document specified by a FileInputStream object.
 void loadDocument(FileInputStream fileInputStream, String password)
          Loads document specified by a FileInputStream object for printing.
 void loadDocument(File inFile, String password)
          Loads document specified by a File object with specified password.
 void loadDocument(String inFilePath)
          Loads document in specified path for printing.
 void loadDocument(String inFilePath, String password)
          Loads encrypted document in specified path with specified password.
static void loadFontProcessorLibrary(String libDirPath)
          Deprecated. no replacement
 int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
           
 void print(String pageRange, int numOfCopies)
          Prints pages in specified page range for specified times.
 void print(String selPrinterName, String pageRange, int numOfCopies)
          Prints pages in specified page range for specified times using specified printer.
 void printToFile(boolean printToFile)
          Specifies whether printer needs to print to a file.
 void setCopies(int copies)
          Specifies number of copies that need to be made for the print job.
 void setCustomPageDimension(double width, double height, int measurementUnit)
          Sets custom dimensions for the default page of the printer.
 void setDocument(PdfDocument d)
          Sets up a PdfDocument object with the printer object.
 void setFinishings(Finishings finishings)
          Specifies finishing operations for the current print job.
 void setOrientation(int orientation)
          Sets default printer page orientation.
 void setPageMargins(double[] pageMargins, int inUnits)
          Sets specified page margins in specified measurement units.
 void setPageRange(String pageRange)
          Specifies page range for the next print job.
 void setPageScale(int pageScale)
          Specifies how pages need to be resized for the next print job.
 void setPageSize(int paperSize)
          Specifies size of printer pages that need to be selected for the next print job.
 void setPaperSize(int paperSize)
          Deprecated. Instead, use setPageSize().
 void setPdfPrintHandler(PdfPrintHandler pdfPrintHandler)
           
 void setPrintChromaticity(Chromaticity chromaticity)
           
 void setPrintJobName(String printJobName)
          Specifies name for the next print job.
 void setPrintMediaTray(MediaTray mediaTray)
          Set specified media tray as current paper source or tray.
 void setPrintPageHandler(PdfPrintPageHandler pdfPrintPageHandler)
          Specifies an instance of user class that implements PdfPrintPageHandler.
 void setPrintSheetCollate(SheetCollate sheetCollate)
          Specifies how print output needs to collated when multiple copies of the document is printed.
 void setPrintSides(Sides sides)
          Specifies how pages from a print job needs to be imposed on the sides of the output media (paper).
 void setPrintToFileName(String printToFileName)
          Specified pathname of the file to which the printer has been set to print.
 void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
          Specifies user class instance that implements the PdfRenderErrorHandler.onRenderError(Object, Throwable) event handler.
 void setReverse(boolean reverse)
          Specifies whether document pages need to be printed in reverse order.
 void setSelectedPrinterName(String selectedPrinterName)
          Specifies name of the selected printer for the next print job.
 void setSubset(int subset)
          Specifies print range subset for the next print job.
 void showCrossPlatformPrintDialog()
          Displays a cross-platform print dialog box.
 void showNativePrintDialog()
          Displays a print dialog box supplied by the native operating system.
 void showPrintDialog()
          Displays this component's print dialog box.
 void showPrintDialog(Dialog owner, boolean modal)
          Displays this component's print dialog box as a modal or non-modal window and with specified dialog as its owner.
 void showPrintDialog(Frame owner, boolean modal)
          Displays this component's print dialog box as a modal or non-modal window and with specified frame as its owner.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBSET_NONE

public static final int SUBSET_NONE
Constant for specifying all pages as the print range subset.

See Also:
Constant Field Values

SUBSET_EVEN_ONLY

public static final int SUBSET_EVEN_ONLY
Constant for specifying only even pages as the print range subset.

See Also:
Constant Field Values

SUBSET_ODD_ONLY

public static final int SUBSET_ODD_ONLY
Constant for specifying only odd pages as the print range subset.

See Also:
Constant Field Values

SCALE_NONE

public static final int SCALE_NONE
Constant for specifying that document pages need to be printed as is, without any resizing.

See Also:
Constant Field Values

SCALE_FIT_TO_PRINTER_MARGINS

public static final int SCALE_FIT_TO_PRINTER_MARGINS
Constant for specifying that document pages need to be resized to exactly fit within printer page margins.

See Also:
Constant Field Values

SCALE_REDUCE_TO_PRINTER_MARGINS

public static final int SCALE_REDUCE_TO_PRINTER_MARGINS
Constant for specifying that document pages need to down-sized to be accommodated within the margins of printer page margins but only when the document page is bigger than the printer page.

See Also:
Constant Field Values

Orientation_PORTRAIT

public static final int Orientation_PORTRAIT
Constant for portrait printer page orientation.

See Also:
setOrientation(int), getOrientation(), Constant Field Values

Orientation_LANDSCAPE

public static final int Orientation_LANDSCAPE
Constant for landscape printer page orientation.

See Also:
setOrientation(int), getOrientation(), Constant Field Values

MU_MM

public static final int MU_MM
Constant for page measurement unit in millimetres.

See Also:
Constant Field Values

MU_INCHES

public static final int MU_INCHES
Constant for page measurement unit in inches.

See Also:
Constant Field Values

MU_POINTS

public static final int MU_POINTS
Constant for page measurement unit in points.

See Also:
Constant Field Values
Constructor Detail

PdfPrinter

public PdfPrinter()

PdfPrinter

public PdfPrinter(PdfDocument d)
           throws PdfException
Deprecated. Instead use a load method or the setDocument(PdfDocument) method. Constructs a PdfPrinter object with specified PdfDocument object.

Method Detail

loadDocument

public void loadDocument(String inFilePath)
                  throws IOException,
                         PdfException
Loads document in specified path for printing.

Parameters:
inFilePath - pathname of the document
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(String inFilePath,
                         String password)
                  throws IOException,
                         PdfException
Loads encrypted document in specified path with specified password.

Parameters:
inFilePath - pathname of the document that needs to be printed
password - password with which the document needs to be opened
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(File inFile)
                  throws IOException,
                         PdfException
Loads document specified by a File object.

Parameters:
inFile - document that needs to be printed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(File inFile,
                         String password)
                  throws IOException,
                         PdfException
Loads document specified by a File object with specified password.

Parameters:
inFile - the document that needs to be printed
password - password with which the document needs to be opened
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(FileInputStream fileInputStream)
                  throws IOException,
                         PdfException
Loads document specified by a FileInputStream object.

Parameters:
fileInputStream - document that needs to be printed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(FileInputStream fileInputStream,
                         String password)
                  throws IOException,
                         PdfException
Loads document specified by a FileInputStream object for printing.

Parameters:
fileInputStream - document that needs to be printed
password - password with which the documents to be opened
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(byte[] byteArray)
                  throws IOException,
                         PdfException
Loads document contained in a specified byte array for printing.

Parameters:
byteArray - document that needs to be printed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

loadDocument

public void loadDocument(byte[] byteArray,
                         String password)
                  throws IOException,
                         PdfException
Loads encrypted document in specfied array with specified password.

Parameters:
byteArray - document that needs to be printed
password - password with which the document needs to be opened
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

setDocument

public void setDocument(PdfDocument d)
Sets up a PdfDocument object with the printer object. When a document is loaded by PdfDocument object, the printer object automatically becomes ready for printing the loaded document. To get notified when PdfDocument object loads a PDF document, user classes need to implement PdfDocumentChangeHandler.

Parameters:
d - PdfDocument object with which this printer component needs to be set up
See Also:
getDocument()

getDocument

public PdfDocument getDocument()
Returns the PdfDocument object that has been set up with this printer object.

Returns:
the PdfDocument object that has been set up with this printer object
See Also:
setDocument(PdfDocument)

print

public void print(String pageRange,
                  int numOfCopies)
           throws IOException,
                  PdfException,
                  PrinterException
Prints pages in specified page range for specified times.

Parameters:
pageRange - pages that need to be printed
numOfCopies - number of times the pages need to be printed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
PrinterException - if a printing error occurs.

print

public void print(String selPrinterName,
                  String pageRange,
                  int numOfCopies)
           throws IOException,
                  PdfException,
                  PrinterException
Prints pages in specified page range for specified times using specified printer.

Parameters:
selPrinterName - printer with which the pages need to be printed
pageRange - pages that need to be printed
numOfCopies - number of times the pages need to be printed
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
PrinterException - if a printing error occurs.

showNativePrintDialog

public void showNativePrintDialog()
                           throws PdfException,
                                  IOException,
                                  PrinterException
Displays a print dialog box supplied by the native operating system. A native print dialog box typically accepts print settings from the user and gives the print command if required by the end-user. Note: Print settings specified with this printer component may not be set in the cross-platform dialog box.

Throws:
PdfException - if an illegal argument is supplied.
IOException - if an I/O error occurs.
PrinterException - an exceptional condition has occurred in the print system.
Since:
3.5.2.12

showCrossPlatformPrintDialog

public void showCrossPlatformPrintDialog()
                                  throws PdfException,
                                         IOException,
                                         PrinterException
Displays a cross-platform print dialog box. The dialog accepts print settings from the end-user and gives the print command if required. On the dialog box, user can select the printer, page range, number of copies. The document is printed only if the OK button is selected. If the user selects the Cancel button, the document will not be printed. Note: Print settings specified with this printer component may not be set in the cross-platform dialog box.

Throws:
PdfException - if an illegal argument is supplied.
IOException - if an I/O error occurs.
PrinterException - an exceptional condition has occurred in the print system.
Since:
3.5.2.12

showPrintDialog

public void showPrintDialog()
                     throws PdfException
Displays this component's print dialog box. The dialog accepts print settings from the end-user and gives the print command if required by the end-user. On the dialog box, user can select the printer, page range, number of copies. The document is printed only if the OK button is selected. If the user selects the Cancel button, the document will not be printed.

Throws:
PdfException - if an illegal argument is supplied.

showPrintDialog

public void showPrintDialog(Frame owner,
                            boolean modal)
                     throws PdfException
Displays this component's print dialog box as a modal or non-modal window and with specified frame as its owner. The print dialog box accepts print settings from the end-user and gives the print command if required by the end-user. On the dialog box, user can select the printer, page range, number of copies. The document is printed only if the OK button is selected. If the user selects the Cancel button, the document will not be printed.

Parameters:
owner - owner frame of the displayed dialog box
modal - whether the displayed dialog box needs to be a modal window
Throws:
PdfException - if an illegal argument is supplied.

showPrintDialog

public void showPrintDialog(Dialog owner,
                            boolean modal)
                     throws PdfException
Displays this component's print dialog box as a modal or non-modal window and with specified dialog as its owner. The print dialog box accepts print settings from the end-user and gives the print command if required by the end-user. On the dialog box, user can select the printer, page range, number of copies. The document is printed only if the OK button is selected. If the user selects the Cancel button, the document will not be printed.

Parameters:
owner - owner dialog of the displayed dialog box
modal - whether the displayed dialog box needs to be a modal window
Throws:
PdfException - if an illegal argument is supplied.

setPrintJobName

public void setPrintJobName(String printJobName)
Specifies name for the next print job.

Parameters:
printJobName - name for the next print job
See Also:
getPrintJobName()

getPrintJobName

public String getPrintJobName()
Returns name specified for the next print job.

Returns:
name specified for the next print job
See Also:
setPrintJobName(String)

setSelectedPrinterName

public void setSelectedPrinterName(String selectedPrinterName)
                            throws PdfException
Specifies name of the selected printer for the next print job.

Parameters:
selectedPrinterName - name of the selected printer for the next print job
Throws:
PdfException - if print services are not available.
See Also:
getSelectedPrinterName()

getSelectedPrinterName

public String getSelectedPrinterName()
Returns name of the selected printer for the next print job.

Returns:
name of the selected printer for the next print job
See Also:
setSelectedPrinterName(String)

setPaperSize

public void setPaperSize(int paperSize)
Deprecated. Instead, use setPageSize().

Specifies size of the pages for the next print job.

Parameters:
paperSize - size of the pages for the next print job
See Also:
getPageSize()

setPageSize

public void setPageSize(int paperSize)
Specifies size of printer pages that need to be selected for the next print job. If paperSize is set to PdfPageSize.CUSTOM, then set custom page size by calling setCustomPageDimension(double, double, int).

Parameters:
paperSize - size of the page
See Also:
getPageSize()

setCustomPageDimension

public void setCustomPageDimension(double width,
                                   double height,
                                   int measurementUnit)
                            throws PdfException
Sets custom dimensions for the default page of the printer. Call this method if default page size has been set to PdfPageSize.CUSTOM. If this method is not called, then default page size (width x height) will be set to 612 x 792 points .

Parameters:
width - width of the default page of the printer
height - height of the default page of the printer
measurementUnit - constant specifying the measurement unit with which the width and height of the default page of the printer needs to be interpreted
Throws:
PdfException - if an illegal argument is supplied.

setPageMargins

public void setPageMargins(double[] pageMargins,
                           int inUnits)
                    throws PdfException
Sets specified page margins in specified measurement units.

Parameters:
pageMargins - array containing left, top, right and bottom margins
inUnits - measurement units with which the margins need to be interpreted
Throws:
PdfException - if an illegal argument is supplied.
See Also:
getPageMargins(), getPageMargins(int)

getPageMargins

public double[] getPageMargins()
Returns page margins in default measurement units.

Returns:
array containing left, top, right and bottom margins
See Also:
getPageMargins(int), setPageMargins(double[], int)

getPageMargins

public double[] getPageMargins(int inMeasurementUnit)
                        throws PdfException
Returns page margins in specified measurement unit.

Parameters:
inMeasurementUnit - measurement unit in which the margins need to be returned
Returns:
array containing left, top, right and bottom margins
Throws:
PdfException - if an illegal argument is supplied.
See Also:
PdfMeasurement, getPageMargins(), setPageMargins(double[], int)

getPageSize

public int getPageSize()
Returns size of the pages for the next print job.

Returns:
size of the pages for the next print job
See Also:
setPageSize(int)

setPageRange

public void setPageRange(String pageRange)
Specifies page range for the next print job.

Parameters:
pageRange - pages that need to be printed
Throws:
PdfException - if an illegal argument is supplied.
See Also:
getPageRange()

getPageRange

public String getPageRange()
Returns page range of the next print job.

Returns:
pages that will be printed
See Also:
setPageRange(String)

getAvailablePrinterNames

public String[] getAvailablePrinterNames()
Returns names of all printers available for printing.

Returns:
names of all available printers

getDefaultPrinterName

public String getDefaultPrinterName()
Returns name of default printer to which this printer object to will print.

Returns:
name of default printer to which this printer object to will print

setCopies

public void setCopies(int copies)
Specifies number of copies that need to be made for the print job.

Parameters:
copies - number of copies
See Also:
getCopies()

getCopies

public int getCopies()
Returns number of copies for the print job.

Returns:
number of copies
See Also:
setCopies(int)

setSubset

public void setSubset(int subset)
Specifies print range subset for the next print job.

Parameters:
subset - constant specifying the print range subset
See Also:
getSubset()

getSubset

public int getSubset()
Returns print range subset of the next print job.

Returns:
constant specifying the print range subset
See Also:
setSubset(int)

setPageScale

public void setPageScale(int pageScale)
Specifies how pages need to be resized for the next print job.

Parameters:
pageScale - constant specififying page scaling
See Also:
getPageScale()

getPageScale

public int getPageScale()
Returns how pages will be resized for the next print job.

Returns:
constant specifying page scaling
See Also:
setPageScale(int)

autoRotateandCenter

public void autoRotateandCenter(boolean autoRotateandCenter)
Specifies whether rotated pages in the document need to be rotated and centered when they are printed.

Parameters:
autoRotateandCenter - true for auto-rotate and center; false for otherwise.
See Also:
isAutoRotateandCenter()

isAutoRotateandCenter

public boolean isAutoRotateandCenter()
Returns whether rotated pages in the document aer set to be rotated and centered when they are printed.

Returns:
true if set for auto-rotate and center; false if otherwise.
See Also:
autoRotateandCenter(boolean)

setReverse

public void setReverse(boolean reverse)
Specifies whether document pages need to be printed in reverse order.

Parameters:
reverse - true if pages need to printed in reverse order; false if otherwise.
See Also:
isReverse()

isReverse

public boolean isReverse()
Returns whether all pages are set for being printed in reverse order.

Returns:
true if pages will be printed in reverse; false if otherwise.
See Also:
setReverse(boolean)

setOrientation

public void setOrientation(int orientation)
Sets default printer page orientation.

Parameters:
orientation - constant specifying printer page orientation
See Also:
Orientation_LANDSCAPE, Orientation_PORTRAIT, getOrientation()

getOrientation

public int getOrientation()
Returns default printer page orientation.

Returns:
constant indicating default printer page orientation
See Also:
Orientation_LANDSCAPE, Orientation_PORTRAIT, setOrientation(int)

setPrintToFileName

public void setPrintToFileName(String printToFileName)
                        throws PdfException
Specified pathname of the file to which the printer has been set to print.

Parameters:
printToFileName - pathname of the file to which the printer needs to print
Throws:
PdfException - if printToFile(boolean) has been set to false

getPrintToFileName

public String getPrintToFileName()
                          throws PdfException
Returns pathname of the file to which printer has been set to print.

Returns:
pathname of the file to which printer has been set to print
Throws:
PdfException - if printToFile(boolean) has been set to false

printToFile

public void printToFile(boolean printToFile)
Specifies whether printer needs to print to a file.

Parameters:
printToFile - whether the printer should print to a file
See Also:
setPrintToFileName(String), getPrintToFileName(), isPrintToFile()

isPrintToFile

public boolean isPrintToFile()
Specifies whether printer is set to print to a file.

Returns:
whether printer is set to print to a file

getPageDimension

public double[] getPageDimension()
Returns dimensions of default page size of the printer.

Returns:
array containing width and height of the default page in default measurement unit
See Also:
getPageDimension(int)

getPageDimension

public double[] getPageDimension(int inMeasurementUnit)
                          throws PdfException
Returns dimensions of default page size of the printer, in specified measurement unit.

Parameters:
inMeasurementUnit - measurement unit in which the dimensions need to be returned ( MU_INCHES, MU_MM or MU_POINTS)
Returns:
array containing width and height of the default page size of the printer
Throws:
PdfException - if an illegal argument is supplied.

setPrintMediaTray

public void setPrintMediaTray(MediaTray mediaTray)
Set specified media tray as current paper source or tray.

Parameters:
mediaTray - paper sourcr or tray which needs to be used for subsequent print jobs
See Also:
getPrintMediaTray()

getPrintMediaTray

public MediaTray getPrintMediaTray()
Returns current paper source or tray.

Returns:
current media tray
See Also:
setPrintMediaTray(MediaTray)

setPrintChromaticity

public void setPrintChromaticity(Chromaticity chromaticity)

getPrintChromaticity

public Chromaticity getPrintChromaticity()

setPrintSides

public void setPrintSides(Sides sides)
Specifies how pages from a print job needs to be imposed on the sides of the output media (paper).

Parameters:
sides - printing attribute that specifies how pages from a print job needs to be imposed on the sides of the output media (paper)
See Also:
getPrintSides()

getPrintSides

public Sides getPrintSides()
Returns how pages from a print job are imposed on the sides of the output media (paper).

Returns:
printing attribute specifying how pages from a print job are imposed on the sides of the output media (paper)
See Also:
setPrintSides(Sides)

setPrintSheetCollate

public void setPrintSheetCollate(SheetCollate sheetCollate)
Specifies how print output needs to collated when multiple copies of the document is printed.

Parameters:
sheetCollate - printing attribute that specifies how print output needs to collated when multiple copies of the document is printed
See Also:
getPrintSheetCollate()

getPrintSheetCollate

public SheetCollate getPrintSheetCollate()
Returns how print output is collated when multiple copies of the document is printed.

Returns:
printing attribute that specifies how print output is collated when multiple copies of the document is printed
See Also:
setPrintSides(Sides)

print

public int print(Graphics graphics,
                 PageFormat pageFormat,
                 int pageIndex)
          throws PrinterException
Specified by:
print in interface Printable
Throws:
PrinterException

setPrintPageHandler

public void setPrintPageHandler(PdfPrintPageHandler pdfPrintPageHandler)
Specifies an instance of user class that implements PdfPrintPageHandler. Set an new instance of the user class so that PdfDocument objects in the user class can call the PdfPrintPageHandler events.

Parameters:
pdfPrintPageHandler - instance of user class that implements PdfPrintPageHandler

getPrintPageHandler

public PdfPrintPageHandler getPrintPageHandler()

setPdfPrintHandler

public void setPdfPrintHandler(PdfPrintHandler pdfPrintHandler)

getPdfPrintHandler

public PdfPrintHandler getPdfPrintHandler()

closeDocument

public void closeDocument()
                   throws IOException,
                          PdfException
Closes the loaded document.

Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.

isFontProcessorLibraryLoaded

public static boolean isFontProcessorLibraryLoaded()
Deprecated. no replacement

Returns:

loadFontProcessorLibrary

public static void loadFontProcessorLibrary(String libDirPath)
                                     throws PdfException
Deprecated. no replacement

Returns:
Throws:
PdfException

setRenderErrorHandler

public void setRenderErrorHandler(PdfRenderErrorHandler pdfRenderErrorHandler)
Specifies user class instance that implements the PdfRenderErrorHandler.onRenderError(Object, Throwable) event handler.

Parameters:
pdfRenderErrorHandler - user class event handler

getRenderErrorHandler

public PdfRenderErrorHandler getRenderErrorHandler()

setFinishings

public void setFinishings(Finishings finishings)
Specifies finishing operations for the current print job.

Parameters:
finishings - finishing operations that need to be performed on the printed document
See Also:
getFinishings()

getFinishings

public Finishings getFinishings()
Returns finishing operations that are set to be performed for the current print job.

Returns:
finishing operations for current print job
See Also:
setFinishings(Finishings)

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com