public class PaperClips
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
debug |
static int |
ORIENTATION_DEFAULT
Indicates that the printer's default page orientation should be used.
|
static int |
ORIENTATION_LANDSCAPE
Indicates landscape page orientation.
|
static int |
ORIENTATION_PORTRAIT
Indicates portrait page orientation.
|
Modifier and Type | Method and Description |
---|---|
static void |
endDummyJob(org.eclipse.swt.printing.Printer printer)
Ends a dummy job on the given Printer if the platform requires a dummy
job.
|
static void |
error(int code)
Triggers an appropriate exception based on the passed in error code.
|
static void |
error(int code,
java.lang.String detail)
Triggers an appropriate exception based on the passed in error code.
|
static void |
error(java.lang.String detail)
Triggers an unspecified exception with the passed in detail.
|
static boolean |
getDebug()
EXPERIMENTAL: Returns whether debug mode is enabled.
|
static org.eclipse.swt.printing.PrinterData |
getDefaultPrinterData()
Returns a PrinterData for the system-default printer, or the first
printer if no default printer is configured.
|
static org.eclipse.swt.graphics.Rectangle |
getMarginBounds(Margins margins,
org.eclipse.swt.printing.Printer printer)
Returns the bounding rectangle of the printable area which is inside the
given margins on the paper.
|
static PageEnumeration |
getPageEnumeration(PrintJob printJob,
org.eclipse.swt.printing.Printer printer,
org.eclipse.swt.graphics.GC gc)
Returns a
PageEnumeration for the passed in PrintJob on the given
Printer, using the given GC. |
static PrintPiece[] |
getPages(PrintJob printJob,
org.eclipse.swt.printing.Printer printer)
Processes the print job and returns an array of pages for the given
printer device.
|
static org.eclipse.swt.graphics.Rectangle |
getPaperBounds(org.eclipse.swt.printing.Printer printer)
Returns the bounding rectangle of the paper, including non-printable
margins.
|
static org.eclipse.swt.graphics.Rectangle |
getPrintableBounds(org.eclipse.swt.printing.Printer printer)
Returns the bounding rectangle of the printable area on the paper.
|
static PrintPiece |
next(PrintIterator iterator,
int width,
int height)
Calls iterator.next(width, height) and returns the result.
|
static void |
print(PrintJob printJob,
org.eclipse.swt.printing.Printer printer)
Prints the print job to the given printer.
|
static void |
print(PrintJob printJob,
org.eclipse.swt.printing.PrinterData printerData)
Prints the print job to the given printer.
|
static void |
setDebug(boolean debug)
EXPERIMENTAL: Sets whether debug mode is enabled.
|
static void |
startDummyJob(org.eclipse.swt.printing.Printer printer,
java.lang.String name)
Starts a dummy job on the given Printer if the platform requires it.
|
static boolean debug
public static final int ORIENTATION_DEFAULT
public static final int ORIENTATION_PORTRAIT
public static final int ORIENTATION_LANDSCAPE
public static void error(int code)
code
- the SWT error code.public static void error(java.lang.String detail)
detail
- more information about error.public static void error(int code, java.lang.String detail)
code
- the SWT error code.detail
- more information about error.public static void setDebug(boolean debug)
THIS API IS EXPERIMENTAL AND MAY BE REMOVED OR CHANGED IN THE FUTURE.
debug
- true to enable debug mode, false to disable it.public static boolean getDebug()
THIS API IS EXPERIMENTAL AND MAY BE REMOVED OR CHANGED IN THE FUTURE.
public static org.eclipse.swt.printing.PrinterData getDefaultPrinterData()
public static PrintPiece next(PrintIterator iterator, int width, int height)
This method is intended to be used by PrintIterator classes, as a
results-checking alternative to calling next(int, int) directly on the
target iterator. All PrintIterator classes in the PaperClips library use
this method instead of directly calling the
PrintIterator.next(int, int)
method.
iterator
- the PrintIteratorwidth
- the available width.height
- the available height.public static void print(PrintJob printJob, org.eclipse.swt.printing.PrinterData printerData)
print(PrintJob, Printer)
, and disposes the
printer before returning.printJob
- the print job.printerData
- the PrinterData of the selected printer.public static void print(PrintJob printJob, org.eclipse.swt.printing.Printer printer)
printJob
- the print job.printer
- the printer device.public static PrintPiece[] getPages(PrintJob printJob, org.eclipse.swt.printing.Printer printer)
print(PrintJob, Printer)
method.printer
- the printing device.printJob
- the print job.public static void startDummyJob(org.eclipse.swt.printing.Printer printer, java.lang.String name)
printer
- the Printer hosting the dummy print job.name
- the name of the dummy print job.public static void endDummyJob(org.eclipse.swt.printing.Printer printer)
printer
- the Printer hosting the dummy print job.public static PageEnumeration getPageEnumeration(PrintJob printJob, org.eclipse.swt.printing.Printer printer, org.eclipse.swt.graphics.GC gc)
PageEnumeration
for the passed in PrintJob on the given
Printer, using the given GC. The Printer and GC must not be disposed
while the enumeration is in use.printJob
- the print jobprinter
- the Printer device, which must not be disposed while the
PageEnumeration is in use.gc
- the GC, which must not be disposed while the PageEnumeration
is in use.PageEnumeration
for the passed in PrintJob.public static org.eclipse.swt.graphics.Rectangle getPaperBounds(org.eclipse.swt.printing.Printer printer)
printer
- the printer device.public static org.eclipse.swt.graphics.Rectangle getPrintableBounds(org.eclipse.swt.printing.Printer printer)
printer
- the printer device.public static org.eclipse.swt.graphics.Rectangle getMarginBounds(Margins margins, org.eclipse.swt.printing.Printer printer)
printer
- the printer device.margins
- the desired page margins.