|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.icesoft.pdf.ri.common.PrintHelper
The PrintHelper class is utility class to aid developers in
printing PDF document content. The PrintHelper takes advantage of the
Pageable and Printable interfaces availabe in Java 2.
| Field Summary |
| Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
| Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
PrintHelper(DocumentViewController viewController,
PageTree pageTree)
Creates a new PrintHelper instance. |
|
PrintHelper(SwingController controller)
Creates a new PrintHelper instance. |
|
| Method Summary | |
int |
getCurrentPage()
Gets the page number of the page currently being spooled by the Printable interface. |
int |
getNumberOfPages()
Gets the number of pages that have been selected for printing. |
PageFormat |
getPageFormat(int pageIndex)
Returns the PageFormat of the page specified by pageIndex. |
Printable |
getPrintable(int pageIndex)
Returns the Printable instance responsible for rendering the page specified by pageIndex. |
int |
print(Graphics printGraphics,
PageFormat pageFormat,
int pageIndex)
Prints the page at the specified index into the specified java.awt.Graphics context in the specified format. |
void |
print(PrinterJob printerJob,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPageSetupDialog,
boolean showPrintDialog,
PageFormat docPageFormat)
Print a range of pages from the document. |
boolean |
setupPrintJob(PrinterJob printerJob,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPageSetupDialog,
boolean showPrintDialog,
PageFormat docPageFormat)
Configures the PrinterJob instance with the specified parameters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PrintHelper(DocumentViewController viewController,
PageTree pageTree)
PrintHelper instance.
viewController - pageTree - public PrintHelper(SwingController controller)
PrintHelper instance.
controller - | Method Detail |
public int getNumberOfPages()
getNumberOfPages in interface Pageablepublic int getCurrentPage()
public boolean setupPrintJob(PrinterJob printerJob,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPageSetupDialog,
boolean showPrintDialog,
PageFormat docPageFormat)
SwingController and
PrinterTask
to print in a background process, otherwise you should use
the print(java.awt.print.PrinterJob, int, int, int, boolean, boolean, boolean, java.awt.print.PageFormat)
method.
printerJob - printer job that controls printing. If null, a default
printer job will be created.startPage - start of page range, zero-based index.endPage - end of page range, zero-based index.copies - number of copies of pages in print range.shrinkToPrintableArea - true, to enable shrink to fit printable area;
false, otherwise.showPageSetupDialog - true, to display a page setup dialog when this method
is initiated; false, otherwise. This dialog will be shown before the
print dialog.showPrintDialog - true, to display a print setup dialog when this method
is initiated; false, otherwise. This dialog will be shown after the
page dialog if it is visible.docPageFormat - Page Format to be associated with print job. If null, a
default Page Format will be created.
public int print(Graphics printGraphics,
PageFormat pageFormat,
int pageIndex)
print in interface PrintableprintGraphics - pageFormat - pageIndex -
public Printable getPrintable(int pageIndex)
getPrintable in interface PageablepageIndex -
public PageFormat getPageFormat(int pageIndex)
getPageFormat in interface PageablepageIndex -
public void print(PrinterJob printerJob,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPageSetupDialog,
boolean showPrintDialog,
PageFormat docPageFormat)
printerJob - printer job that controls printing. If null, a default
printer job will be created.startPage - start of page range, zero-based index.endPage - end of page range, zero-based index.copies - number of copies of pages in print range.shrinkToPrintableArea - true, to enable shrink to fit printable area;
false, otherwise.showPageSetupDialog - true, to display a page setup dialog when this method
is initiated; false, otherwise. This dialog will be shown before the
print dialog.showPrintDialog - true, to display a print setup dialog when this method
is initiated; false, otherwise. This dialog will be shown after the
page dialog if it is visible.docPageFormat - Page Format to be associated with print job. If null, a
default Page Format will be created.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||