|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.ri.common.PrintHelper
public class 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.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree)
Creates a new PrintHelper instance defaulting the
paper size to Letter and the print quality to Draft. |
|
PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree,
javax.print.attribute.HashDocAttributeSet docAttributeSet,
javax.print.attribute.HashPrintRequestAttributeSet printRequestAttributeSet)
Creates a new PrintHelper instance using the specified
doc and print attribute sets. |
|
PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree,
javax.print.attribute.standard.MediaSizeName paperSizeName,
javax.print.attribute.standard.PrintQuality printQuality)
Creates a new PrintHelper instance using the specified
media sized and print quality. |
|
PrintHelper(SwingController controller)
Creates a new PrintHelper instance. |
|
| Method Summary | |
|---|---|
javax.print.CancelablePrintJob |
cancelablePrint()
|
int |
getCurrentPage()
Gets the page number of the page currently being spooled by the Printable interface. |
javax.print.attribute.HashDocAttributeSet |
getDocAttributeSet()
Gets the document attributes currently in use. |
int |
getNumberOfPages()
Number of total pages being printed. |
javax.print.attribute.HashPrintRequestAttributeSet |
getPrintRequestAttributeSet()
Gets the print request attribute sets. |
javax.print.PrintService |
getPrintService()
Gets the currently assigned print service. |
float |
getUserRotation()
Users rotation specified for the print job. |
boolean |
isPrintFitToMargin()
Gets the fit to margin property. |
void |
print()
Print a range of pages from the document as specified by #setupPrintService. |
int |
print(java.awt.Graphics printGraphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
Prints the page at the specified index into the specified java.awt.Graphics context in the specified format. |
void |
print(PrintJobWatcher printJobWatcher)
|
boolean |
setupPrintService(int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPrintDialog)
Configures the PrinterJob instance with the specified parameters. |
void |
setupPrintService(javax.print.PrintService printService,
javax.print.attribute.HashPrintRequestAttributeSet printRequestAttributeSet,
boolean shrinkToPrintableArea)
Configures the PrinterJob instance with the specified parameters. |
void |
setupPrintService(javax.print.PrintService printService,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea)
Configures the PrinterJob instance with the specified parameters. |
void |
showPrintSetupDialog()
Utility for showing print dialog for the current printService. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree)
PrintHelper instance defaulting the
paper size to Letter and the print quality to Draft.
viewController - document view controllerpageTree - doucment page tree.
public PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree,
javax.print.attribute.standard.MediaSizeName paperSizeName,
javax.print.attribute.standard.PrintQuality printQuality)
PrintHelper instance using the specified
media sized and print quality.
viewController - document view controllerpageTree - doucment page tree.paperSizeName - MediaSizeName constant of paper size to print to.printQuality - quality of the print job, draft, quality etc.
public PrintHelper(org.icepdf.core.views.DocumentViewController viewController,
org.icepdf.core.pobjects.PageTree pageTree,
javax.print.attribute.HashDocAttributeSet docAttributeSet,
javax.print.attribute.HashPrintRequestAttributeSet printRequestAttributeSet)
PrintHelper instance using the specified
doc and print attribute sets. This constructor offers the most flexibility
as it allows the attributes sets to be pre configured. This method
should only be used by advanced users.
viewController - document view controllerpageTree - doucment page tree.docAttributeSet - MediaSizeName constant of paper size to print to.printRequestAttributeSet - quality of the print job, draft, quality etc.public PrintHelper(SwingController controller)
PrintHelper instance.
controller - dcoument controller.| Method Detail |
|---|
public boolean setupPrintService(int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea,
boolean showPrintDialog)
startPage - start of page range, zero-based index.endPage - end of page range, one-based index.copies - number of copies of pages in print range.shrinkToPrintableArea - true, to enable shrink to fit printable area;
false, otherwise.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.
public void setupPrintService(javax.print.PrintService printService,
int startPage,
int endPage,
int copies,
boolean shrinkToPrintableArea)
printService - print service to print document to.startPage - start of page range, zero-based index.endPage - end of page range, one-based index.copies - number of copies of pages in print range.shrinkToPrintableArea - true, to enable shrink to fit printable area;
false, otherwise.
public void setupPrintService(javax.print.PrintService printService,
javax.print.attribute.HashPrintRequestAttributeSet printRequestAttributeSet,
boolean shrinkToPrintableArea)
printService - print service to print document to.printRequestAttributeSet - print jobt attribute set.shrinkToPrintableArea - true, to enable shrink to fit printable area;
false, otherwise.public void showPrintSetupDialog()
public int getCurrentPage()
public int getNumberOfPages()
public boolean isPrintFitToMargin()
public float getUserRotation()
public javax.print.attribute.HashDocAttributeSet getDocAttributeSet()
public javax.print.attribute.HashPrintRequestAttributeSet getPrintRequestAttributeSet()
public javax.print.PrintService getPrintService()
public int print(java.awt.Graphics printGraphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
print in interface java.awt.print.PrintableprintGraphics - paper graphics context.pageFormat - print attributes translated from PrintServicepageIndex - page to print, zero based.
public void print()
throws javax.print.PrintException
javax.print.PrintException - if a default printer could not be found or some
other printing related error.
public javax.print.CancelablePrintJob cancelablePrint()
throws javax.print.PrintException
javax.print.PrintException
public void print(PrintJobWatcher printJobWatcher)
throws javax.print.PrintException
javax.print.PrintException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||