com.sun.pdfview
Class PDFPrintPage

java.lang.Object
  extended by com.sun.pdfview.PDFPrintPage
All Implemented Interfaces:
java.awt.print.Printable

public class PDFPrintPage
extends java.lang.Object
implements java.awt.print.Printable

A class representing a print job for a particular PDFFile. The class maintains a status dialog as it prints, allowing the user to cancel the print job.


Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PDFPrintPage(PDFFile file)
          Create a new PDFPrintPage object for a particular PDFFile.
 
Method Summary
 void doCancel()
          Cancel the print job.
 void hide()
          Close the progress dialog.
 int print(java.awt.Graphics g, java.awt.print.PageFormat format, int index)
           
 void printFile(java.lang.String filename, boolean setupPaper)
          An example method to print a file.
 void show(java.awt.print.PrinterJob pjob)
          Show the progress dialog for this print job
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFPrintPage

public PDFPrintPage(PDFFile file)
Create a new PDFPrintPage object for a particular PDFFile.

Parameters:
file - the PDFFile to be printed.
Method Detail

printFile

public void printFile(java.lang.String filename,
                      boolean setupPaper)
               throws java.io.IOException
An example method to print a file.

Parameters:
filename - The path of the PDF file to print.
setupPaper - true to post a page setup dialog
Throws:
java.io.IOException

show

public void show(java.awt.print.PrinterJob pjob)
Show the progress dialog for this print job

Parameters:
pjob - the PrinterJob representing the print job

hide

public void hide()
Close the progress dialog. Don't use this method to cancel the print job; use doCancel instead.


doCancel

public void doCancel()
Cancel the print job. Disables the cancel button, as it might take a while for the cancel to take effect.


print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat format,
                 int index)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException