APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.print

public abstract Class RasterPrinterJob

extends PrinterJob
Class Inheritance
Known Direct Subclasses
sun.print.PSPrinterJob
Imports
java.awt.Color, .Graphics2D, .GraphicsConfiguration, .GraphicsEnvironment, .HeadlessException, .KeyboardFocusManager, .Rectangle, .Shape, .Window, java.awt.geom.AffineTransform, .Point2D, .Rectangle2D, java.awt.image.BufferedImage, java.awt.print.Book, .PageFormat, .Pageable, .Paper, .Printable, .PrinterAbortException, .PrinterException, .PrinterJob, java.io.File, .IOException, java.util.ArrayList, .Locale, javax.print.Doc, .DocFlavor, .DocPrintJob, .PrintException, .PrintService, .PrintServiceLookup, .ServiceUI, .StreamPrintService, .StreamPrintServiceFactory, javax.print.attribute.Attribute, .AttributeSet, .HashPrintRequestAttributeSet, .PrintRequestAttributeSet, .ResolutionSyntax, .Size2DSyntax, javax.print.attribute.standard.Copies, .Destination, .DialogOwner, .DialogTypeSelection, .Fidelity, .JobName, .JobSheets, .Media, .MediaPrintableArea, .MediaSize, .MediaSizeName, .OrientationRequested, .OutputBin, .PageRanges, .PrinterIsAcceptingJobs, .PrinterResolution, .PrinterState, .PrinterStateReason, .PrinterStateReasons, .RequestingUserName, .SheetCollate, .Sides, sun.awt.image.ByteInterleavedRaster

A class which rasterizes a printer job.
Author
Richard Blanchard

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RasterPrinterJob.GraphicsState

Class to keep state information for redrawing areas "region" is an area at as a high a resolution as possible.

Field Summary

Modifier and TypeField and Description
protected PrintRequestAttributeSet
attributes

attributes used by no-args page and print dialog and print method to communicate state

private BufferedImage
private int
private int
cachedBandWidth

Used to minimize GC & reallocation of band when printing

protected boolean
private int
public static boolean
private AffineTransform
protected String
private int
private int
private static final float
protected static final int
private static final String
FORCE_PDL

When the system property FORCE_PIPE_PROP has this value then each page of a print job will be rendered through the PDL pipeline.

private static final String
FORCE_PIPE_PROP

Useful mainly for debugging, this system property can be used to force the printing code to print using a particular pipeline.

private static final String
FORCE_RASTER

When the system property FORCE_PIPE_PROP has this value then each page of a print job will be rendered through the raster pipeline.

public static boolean
forcePDL

values obtained from System properties in static initialiser block

public static boolean
private String
protected boolean
landscapeRotates270

Device rotation flag, if it support 270, this is set to true;

private static final int
MAX_BAND_SIZE

Maximum amount of memory in bytes to use for the buffered image "band".

protected static final int
MAX_UNKNOWN_PAGES

Pageable MAX pages

private boolean
mCollate

Collation effects the order of the pages printed when multiple copies are requested.

protected String
protected int
private String
mDocName

The name of the job being printed.

protected Pageable
mDocument

The document to be printed.

private int
mFirstPage

The zero based indices of the first and last pages to be printed.

private int
private int
mNumCopies

The number of book copies to be printed.

protected PrintService
myService

Service for this job

protected boolean
private DialogOwner
protected OutputBin
private PageRanges
private long
protected static final int
protected static final int
protected static final int
protected static final int
protected boolean
performingPrinting

Printing cancellation flags

private PrinterGraphicsConfig
private Paper
previousPaper

The previous print stream Paper Used to check if the paper size has changed such that the implementation needs to emit the new paper size information into the print stream.

protected static final int
protected PrinterResolution
private ArrayList<RasterPrinterJob.GraphicsState>
redrawList

List of areas & the graphics state for redrawing

private static final String
SHAPE_TEXT_PROP

When the system property SHAPE_TEXT_PROP has this value then text is always rendered as a shape, and no attempt is made to match the font through GDI

public static boolean
protected Sides
protected static final int
protected boolean
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract void
private PageFormat
public void
cancel()

Implements abstract java.awt.print.PrinterJob.cancel.

If a print job is in progress, print() has been called but has not returned, then this signals that the job should be cancelled and the next chance.

protected void
private void
protected Graphics2D
createPathGraphics(PeekGraphics graphics, PrinterJob printerJob, Printable painter, PageFormat pageFormat, int pageIndex)

Examine the metrics captured by the PeekGraphics instance and if capable of directly converting this print job to the printer's control language or the native OS's graphics primitives, then return a PathGraphics to perform that conversion.

protected PeekGraphics
createPeekGraphics(Graphics2D graphics, PrinterJob printerJob)

Create and return an object that will gather and hold metrics about the print job.

protected void
public PageFormat
defaultPage(PageFormat page)

Implements abstract java.awt.print.PrinterJob.defaultPage.

The passed in PageFormat will be copied and altered to describe the default page size and orientation of the PrinterJob's current printer.

protected abstract void
endDoc()

Called by the print() method at the end of a print job.

protected abstract void
endPage(PageFormat format, Printable painter, int index)

End a page.

protected int
getCollatedCopies()

Returns how many times the entire book should be printed by the PrintJob.

public int
getCopies()

Implements abstract java.awt.print.PrinterJob.getCopies.

Get the number of copies to be printed.

protected int
protected MediaPrintableArea
getDefaultPrintableArea(PageFormat page, double w, double h)

protected int
getFirstPage()

Return the zero based index of the first page to be printed in this job.

protected final int
public String
getJobName()

Implements abstract java.awt.print.PrinterJob.getJobName.

Get the name of the document to be printed.

protected String
protected int
getLastPage()

Return the zero based index of the last page to be printed in this job.

protected final int
protected MediaSize
getMediaSize(Media media, PrintService service, PageFormat page)

protected final int
protected int
getNoncollatedCopies()

Returns how many times each page in the book should be consecutively printed by PrintJob.

protected String
protected Pageable
getPageable()

Return the Pageable describing the pages to be printed.

protected PageFormat
private long
protected abstract double
getPhysicalPageHeight(Paper p)

Must be obtained from the current printer.

protected abstract double
getPhysicalPageWidth(Paper p)

Must be obtained from the current printer.

protected abstract double
getPhysicalPrintableHeight(Paper p)

Must be obtained from the current printer.

protected abstract double
getPhysicalPrintableWidth(Paper p)

Must be obtained from the current printer.

protected abstract double
getPhysicalPrintableX(Paper p)

Must be obtained from the current printer.

protected abstract double
getPhysicalPrintableY(Paper p)

Must be obtained from the current printer.

pack-priv synchronized PrinterGraphicsConfig
public PrintService

Returns:

the service for this printer job.
getPrintService
()

Overrides java.awt.print.PrinterJob.getPrintService.

Returns the service (printer) for this printer job.

protected final int
protected final int
public String
getUserName()

Implements abstract java.awt.print.PrinterJob.getUserName.

Get the name of the printing user.

protected String
protected abstract double
getXRes()

Returns the resolution in dots per inch across the width of the page.

protected abstract double
getYRes()

Returns the resolution in dots per inch down the height of the page.

protected void
protected void
initPrinterGraphics(Graphics2D g, Rectangle2D clip)

Configure the passed in Graphics2D so that is contains the defined initial settings for a print job.

public boolean
isCancelled()

Implements abstract java.awt.print.PrinterJob.isCancelled.

Returns true if a print job is in progress, but is going to be cancelled at the next opportunity; otherwise returns false.

protected boolean
isCollated()

Return true if collated copies will be printed as determined in an attribute set.

protected boolean
protected static PrintService
public PageFormat

Returns:

the original page object if the dialog is cancelled, or a new PageFormat object containing the format indicated by the user if the dialog is acknowledged
pageDialog
(PageFormat
the default PageFormat presented to the user for modification
page
)

Implements abstract java.awt.print.PrinterJob.pageDialog.

Display a dialog to the user allowing the modification of a PageFormat instance.

public PageFormat
pageDialog(final PrintRequestAttributeSet attributes)

Overrides java.awt.print.PrinterJob.pageDialog.

return a PageFormat corresponding to the updated attributes, or null if the user cancelled the dialog.

protected abstract void
printBand(byte[] data, int x, int y, int width, int height)

Prints the contents of the array of ints, 'data' to the current page.

public boolean

Returns:

false if the user cancels the dialog and true otherwise.
printDialog
(final PrintRequestAttributeSet
to store changed properties.
attributes
)

Overrides java.awt.print.PrinterJob.printDialog.

Presents the user a dialog for changing properties of the print job interactively.

public boolean

Returns:

false if the user cancels the dialog and true otherwise.
printDialog
()

Implements abstract java.awt.print.PrinterJob.printDialog.

Presents the user a dialog for changing properties of the print job interactively.

protected int

Returns:

int Printable.PAGE_EXISTS if the page existed and was drawn and Printable.NO_SUCH_PAGE if the page did not exist.
printPage
(Pageable document, int pageIndex)

Print a page from the provided document.

public static String

Returns:

the input text, with ignorable whitespace (if any) removed
removeControlChars
(String
the text to process
s
)

Removes ignorable whitespace from the specified text, so that there is no need for platform-specific or font-specific custom whitespace handling, and so that these characters are not treated like control characters which are printed as the missing glyph.

public void
saveState(AffineTransform at, Shape clip, Rectangle2D region, double sx, double sy)

save graphics state of a PathGraphics for later redrawing of part of page represented by the region in that state

protected void
protected void
setCollated(boolean collate)

Set whether copies should be collated or not.

public void
setCopies(int copies)

Implements abstract java.awt.print.PrinterJob.setCopies.

Set the number of copies to be printed.

protected synchronized void
setGraphicsConfigInfo(AffineTransform at, double pw, double ph)

public void
setJobName(String jobName)

Implements abstract java.awt.print.PrinterJob.setJobName.

Set the name of the document to be printed.

public void
setPageable(Pageable
The document to be printed. It may not be null.
document
)

Implements abstract java.awt.print.PrinterJob.setPageable.

The pages in the document to be printed are held by the Pageable instance 'document'.

protected void
setPageRange(int firstPage, int lastPage)

Set the range of pages from a Book to be printed.

private void
public void
setPrintable(Printable
Called to render each page of the document.
painter
)

Implements abstract java.awt.print.PrinterJob.setPrintable.

The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'.

public void
setPrintable(Printable
Called to render each page of the document.
painter
,
PageFormat
The size and orientation of each page to be printed.
format
)

Implements abstract java.awt.print.PrinterJob.setPrintable.

The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'.

public void
setPrintService(PrintService
print service which supports 2D printing.
service
)

Overrides java.awt.print.PrinterJob.setPrintService.

Associate this PrinterJob with a new PrintService.

protected void
setXYRes(double x, double y)

Set the device resolution.

protected void
protected abstract void
startDoc()

Called by the print() method at the start of a print job.

protected abstract void
startPage(PageFormat format, Printable painter, int index, boolean paperChanged)

Begin a new page.

protected void
protected void
protected void
public PageFormat
validatePage(PageFormat page)

Implements abstract java.awt.print.PrinterJob.validatePage.

The passed in PageFormat is cloned and altered to be usable on the PrinterJob's current printer.

protected void
validatePaper(Paper origPaper, Paper newPaper)

updates a Paper object to reflect the current printer's selected paper size and imageable area for that paper size.

Inherited from java.awt.print.PrinterJob:
defaultPagegetPageFormatgetPrinterJoblookupPrintServiceslookupStreamPrintServices