|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.crionics.jpdf.creator.JPdfScreenshotPrinter
public final class JPdfScreenshotPrinter
A simple utility class that lets you do screen dumps of Java2D components
without the need to write a specific print method.
The object can be called using two different methods:
1. A static call
JPdfScreenshotPrinter.printComponent(myJPanel);
2. Using an instance
JPdfScreenshotPrinter printer=new JPdfScreenshotPrinter(myJPanel);
print.print();
This second method gives more control as it allows to skip the print preview
panel by passing the desired pageformat as a parameter
// Print on a Letter Portrait, skip print preview panel
print.print(new PageFormat());
| Field Summary | |
|---|---|
static int |
CLIP_ON_PAGES
Clips oversized components on several pages |
static int |
FIT_PAGE
Fits the component on a single page |
static int |
FIT_PAGE_HEIGHT
Resizes the component to the page height |
static int |
FIT_PAGE_WIDTH
Resizes the component to the page width |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
JPdfScreenshotPrinter()
Creates a screenshot printer object. |
|
JPdfScreenshotPrinter(java.io.File destination)
Creates a screenshot printer object. |
|
| Method Summary | |
|---|---|
int |
getFitPreferences()
gets the clipping preferences |
java.awt.print.PageFormat |
getPageFormat()
|
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat1,
int pageIndex)
Should not be called directly, used internally to render components on PDF pages |
void |
printComponent(java.awt.Component theComponent)
A handy method to easily print a Component |
void |
printComponents(java.awt.Component[] theComponent)
|
void |
setFitPreferences(int fitpref)
Sets the clipping preferences |
void |
setPageFormat(java.awt.print.PageFormat format)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CLIP_ON_PAGES
public static final int FIT_PAGE_HEIGHT
public static final int FIT_PAGE_WIDTH
public static final int FIT_PAGE
| Constructor Detail |
|---|
public JPdfScreenshotPrinter()
public JPdfScreenshotPrinter(java.io.File destination)
| Method Detail |
|---|
public int getFitPreferences()
public java.awt.print.PageFormat getPageFormat()
public int print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat1,
int pageIndex)
print in interface java.awt.print.Printable
public void printComponent(java.awt.Component theComponent)
throws PdfException
theComponent - the Component to be printed
PdfException
public void printComponents(java.awt.Component[] theComponent)
throws PdfException
PdfExceptionpublic void setFitPreferences(int fitpref)
fitpref - one of FIT_PAGE, CLIP_ON_PAGES, FIT_PAGE_HEIGHT,
FIT_PAGE_WIDTHpublic void setPageFormat(java.awt.print.PageFormat format)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||