|
|||||||||
| 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(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
float userRotation,
javax.print.attribute.HashDocAttributeSet docAttributeSet,
javax.print.attribute.HashPrintRequestAttributeSet printRequestAttributeSet)
Creates a new PrintHelper instance using the specified
doc and print attribute sets. |
|
PrintHelper(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
float rotation,
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(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
int rotation)
Creates a new PrintHelper instance defaulting the
paper size to Letter and the print quality to Draft. |
|
| 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 |
isPaintAnnotation()
Are page annotations going to be printed? |
boolean |
isPaintSearchHighlight()
Are page search highlight's going to be printed? |
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)
|
void |
setPaintAnnotation(boolean paintAnnotation)
Manually enable or disable the printing of annotation for a print job |
void |
setPaintSearchHighlight(boolean paintSearchHighlight)
Manually enable or disable the printing of search highlights for a print job |
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(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
int rotation)
PrintHelper instance defaulting the
paper size to Letter and the print quality to Draft.
container - parent container used to center print dialogs.pageTree - document page tree.
public PrintHelper(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
float rotation,
javax.print.attribute.standard.MediaSizeName paperSizeName,
javax.print.attribute.standard.PrintQuality printQuality)
PrintHelper instance using the specified
media sized and print quality.
container - parent container uses to center print dialog.pageTree - document page tree.rotation - rotation at witch to paint document.paperSizeName - MediaSizeName constant of paper size to print to.printQuality - quality of the print job, draft, quality etc.
public PrintHelper(java.awt.Container container,
org.icepdf.core.pobjects.PageTree pageTree,
float userRotation,
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.
container - parent container uses to center print dialog.pageTree - document page tree.userRotation - rotation of viewdocAttributeSet - MediaSizeName constant of paper size to print to.printRequestAttributeSet - quality of the print job, draft, quality etc.| 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.PrintExceptionpublic boolean isPaintAnnotation()
public void setPaintAnnotation(boolean paintAnnotation)
paintAnnotation - true to paint annotation; otherwise false.public boolean isPaintSearchHighlight()
public void setPaintSearchHighlight(boolean paintSearchHighlight)
paintSearchHighlight - true to paint search highlights; otherwise false.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||