|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.PrintUtilities
public class PrintUtilities
some ease-of-use-functions for printing.
JPrinterSelect| Nested Class Summary | |
|---|---|
static interface |
PrintUtilities.Printer
allows to plug in a printing service into PrintUtilities |
| Field Summary | |
|---|---|
static MediaName |
mediaName
currently uses ISO_A4_WHITE by default |
| Method Summary | |
|---|---|
static String |
getInfoOn(PrintService service)
|
static PrintUtilities.Printer |
getPrinter()
returns the printer to be used |
static String[] |
getPrinterNames()
|
static PrintService |
getPrintServiceByName(String name)
|
static Color |
getTextColor()
|
static Font |
getTextFont()
returns the special font to be used when printing text; may be null |
static ArrayList<Media> |
listMedia(PrintService ps,
Filter<Media> filter)
|
static void |
print(Component c,
boolean scaleToPageWidth)
prints the given component after selecting the desired printer |
static void |
print(JEditorPane jeditorPane,
boolean scaleToPageWidth)
supports to properly print the JEditorPane to multiple pages with 'smart' page breaks. |
static void |
print(PrinterJob printJob,
Component c,
boolean scaleToPageSize)
|
static void |
print(PrinterJob printJob,
JEditorPane jeditorPane,
boolean scaleToPageWidth)
supports to properly print the JEditorPane to multiple pages with 'smart' page breaks. |
static DocPrintJob |
print(PrintService service,
InputStream stream)
|
static void |
printASCIIText(PrintService service,
String text,
boolean formFeed)
prints the given text to the given print service (adding a formFeed if desired) |
static void |
printASCIIText(String text)
calls text(text, true) |
static void |
printASCIIText(String text,
boolean formFeed)
prints the given text to the default printer (adding a formFeed if desired) |
static void |
printFrame(PrinterJob job)
prints a page with a frame to see the printable area (for debugging) |
static void |
printOnePage(PrinterJob printJob,
Component c)
|
static void |
printText(String text)
uses a TextPrinter and utilizes text color and font if set |
static void |
printText(String text,
PrinterJob job,
boolean showDialog)
uses a TextPrinter and utilizes text color and font if set |
static void |
printTextFile(File asciiFile)
|
static void |
printTextFile(PrintService service,
File asciiFile)
|
static void |
printToService(Object... obj)
uses the currently configured Printer object to print the given object. |
static void |
setPrinter(PrintUtilities.Printer printer)
sets the printer to be used |
static void |
setTextColor(Color color)
|
static void |
setTextFont(Font font)
sets a special font to be used when printing text; may be null |
static void |
useA4()
|
static void |
useLetter()
|
static void |
winPrintASCII(File file,
String device)
Deprecated. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static MediaName mediaName
| Method Detail |
|---|
public static String[] getPrinterNames()
public static PrintService getPrintServiceByName(String name)
public static void setPrinter(PrintUtilities.Printer printer)
printToService(Object...),
getPrinter()public static PrintUtilities.Printer getPrinter()
printToService(Object...),
setPrinter(Printer)
public static void printToService(Object... obj)
throws PrintException,
IOException,
IllegalArgumentException,
NullPointerException
NullPointerException - if the embedded printing service is null
PrintException
IOException
IllegalArgumentExceptiongetPrinter(),
setPrinter(Printer),
PrintUtilities.Printerpublic static void useA4()
public static void useLetter()
public static void printFrame(PrinterJob job)
throws PrinterException
PrinterException
public static ArrayList<Media> listMedia(PrintService ps,
Filter<Media> filter)
public static void print(Component c,
boolean scaleToPageWidth)
throws PrinterException
PrinterException
public static void print(PrinterJob printJob,
Component c,
boolean scaleToPageSize)
throws PrinterException
PrinterException
public static void print(JEditorPane jeditorPane,
boolean scaleToPageWidth)
throws PrinterException
PrinterException
public static void print(PrinterJob printJob,
JEditorPane jeditorPane,
boolean scaleToPageWidth)
throws PrinterException
PrinterException
public static void printOnePage(PrinterJob printJob,
Component c)
throws PrinterException
PrinterExceptionpublic static void setTextColor(Color color)
public static Color getTextColor()
public static void setTextFont(Font font)
public static Font getTextFont()
public static void printText(String text)
throws PrintException
PrintExceptionTextPrinter
public static void printText(String text,
PrinterJob job,
boolean showDialog)
throws PrintException
PrintExceptionTextPrinter
public static void printASCIIText(String text)
throws PrintException
text(text, true)
PrintExceptionprintASCIIText(String, boolean)
public static void printASCIIText(String text,
boolean formFeed)
throws PrintException
PrintException
public static void printASCIIText(PrintService service,
String text,
boolean formFeed)
throws PrintException
PrintException
@Deprecated
public static void winPrintASCII(File file,
String device)
throws IOException
print command.
This method is platform dependent.
IOExceptionMisc.start(String...)
public static void printTextFile(File asciiFile)
throws IOException,
PrintException
IOException
PrintException
public static void printTextFile(PrintService service,
File asciiFile)
throws IOException,
PrintException
IOException
PrintException
public static DocPrintJob print(PrintService service,
InputStream stream)
throws IOException,
PrintException
IOException
PrintExceptionpublic static String getInfoOn(PrintService service)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||