public class

PSPrinterJob

extends RasterPrinterJob
java.lang.Object
   ↳ java.awt.print.PrinterJob
     ↳ sun.print.RasterPrinterJob
       ↳ sun.print.PSPrinterJob

Class Overview

A class which initiates and executes a PostScript printer job.

Summary

Nested Classes
class PSPrinterJob.EPSPrinter  
class PSPrinterJob.PluginPrinter PluginPrinter generates EPSF wrapped with a header and trailer comment. 
Constants
int FILL_EVEN_ODD Passed to the setFillMode method this value forces fills to be done using the even-odd fill rule.
int FILL_WINDING Passed to the setFillMode method this value forces fills to be done using the non-zero winding rule.
[Expand]
Inherited Constants
From class sun.print.RasterPrinterJob
[Expand]
Inherited Fields
From class sun.print.RasterPrinterJob
Public Constructors
PSPrinterJob()
Public Methods
boolean printDialog()
Presents the user a dialog for changing properties of the print job interactively.
Protected Methods
void abortDoc()
Invoked if the application cancelled the printjob.
void beginPath()
Called to mark the start of a new path.
void bezierTo(float control1x, float control1y, float control2x, float control2y, float endX, float endY)
Add to the current path a bezier curve formed by the current pen position and the method parameters which are two control points and an ending point.
void closeSubpath()
Close the current subpath by appending a straight line from the current point to the subpath's starting point.
Graphics2D createPathGraphics(PeekGraphics peekGraphics, 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 PSPathGraphics to perform that conversion.
void deviceFill(PathIterator pathIter, Color color, AffineTransform tx, Shape clip)
void drawImageBGR(byte[] bgrData, float destX, float destY, float destWidth, float destHeight, float srcX, float srcY, float srcWidth, float srcHeight, int srcBitMapWidth, int srcBitMapHeight)
Convert the 24 bit BGR image buffer represented by image to PostScript.
void endDoc()
Invoked by the RasterPrintJob super class this method is called after that last page has been imaged.
void endPage(PageFormat format, Printable painter, int index)
The RastePrintJob super class calls this method at the end of each page.
void fillPath()
Fill the current path using the current fill mode and color.
int getCollatedCopies()
Returns how many times the entire book should be printed by the PrintJob.
int getNoncollatedCopies()
Returns how many times each page in the book should be consecutively printed by PrintJob.
float getPenX()
Return the x coordinate of the pen in the current path.
float getPenY()
Return the y coordinate of the pen in the current path.
double getPhysicalPageHeight(Paper p)
Must be obtained from the current printer.
double getPhysicalPageWidth(Paper p)
Must be obtained from the current printer.
double getPhysicalPrintableHeight(Paper p)
Must be obtained from the current printer.
double getPhysicalPrintableWidth(Paper p)
Must be obtained from the current printer.
double getPhysicalPrintableX(Paper p)
For PostScript the origin is in the upper-left of the paper not at the imageable area corner.
double getPhysicalPrintableY(Paper p)
For PostScript the origin is in the upper-left of the paper not at the imageable area corner.
double getXRes()
Return the x resolution of the coordinates to be rendered.
double getYRes()
Return the y resolution of the coordinates to be rendered.
void lineTo(float x, float y)
Generate PostScript to draw a line from the current pen position to (x, y).
void moveTo(float x, float y)
Generate PostScript to move the current pen position to (x, y).
int platformFontCount(Font font, String str)
void printBand(byte[] bgrData, int x, int y, int width, int height)
Prints the contents of the array of ints, 'data' to the current page.
void selectClipPath()
Intersect the gstate's current path with the current clip and make the result the new clip.
void setClip(Shape clip)
void setColor(Color color)
Set the printer's current color to be that defined by color
void setFillMode(int fillRule)
Set the current path rule to be either FILL_EVEN_ODD (using the even-odd file rule) or FILL_WINDING (using the non-zero winding rule.)
boolean setFont(Font font)
Set the current PostScript font.
void setTransform(AffineTransform transform)
void startDoc()
Invoked by the RasterPrinterJob super class this method is called to mark the start of a document.
void startPage(PageFormat pageFormat, Printable painter, int index, boolean paperChanged)
The RasterPrintJob super class calls this method at the start of each page.
boolean textOut(Graphics g, String str, float x, float y, Font mLastFont, FontRenderContext frc, float width)
[Expand]
Inherited Methods
From class sun.print.RasterPrinterJob
From class java.awt.print.PrinterJob
From class java.lang.Object

Constants

protected static final int FILL_EVEN_ODD

Passed to the setFillMode method this value forces fills to be done using the even-odd fill rule.

Constant Value: 1 (0x00000001)

protected static final int FILL_WINDING

Passed to the setFillMode method this value forces fills to be done using the non-zero winding rule.

Constant Value: 2 (0x00000002)

Public Constructors

public PSPrinterJob ()

Public Methods

public boolean printDialog ()

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

Returns
  • true if the user does not cancel the dialog; false otherwise.
Throws
HeadlessException if GraphicsEnvironment.isHeadless() returns true.
See Also

Protected Methods

protected void abortDoc ()

Invoked if the application cancelled the printjob.

protected void beginPath ()

Called to mark the start of a new path.

protected void bezierTo (float control1x, float control1y, float control2x, float control2y, float endX, float endY)

Add to the current path a bezier curve formed by the current pen position and the method parameters which are two control points and an ending point.

protected void closeSubpath ()

Close the current subpath by appending a straight line from the current point to the subpath's starting point.

protected Graphics2D createPathGraphics (PeekGraphics peekGraphics, 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 PSPathGraphics to perform that conversion. If there is not an object capable of the conversion then return null. Returning null causes the print job to be rasterized.

protected void deviceFill (PathIterator pathIter, Color color, AffineTransform tx, Shape clip)

protected void drawImageBGR (byte[] bgrData, float destX, float destY, float destWidth, float destHeight, float srcX, float srcY, float srcWidth, float srcHeight, int srcBitMapWidth, int srcBitMapHeight)

Convert the 24 bit BGR image buffer represented by image to PostScript. The image is drawn at (destX, destY) in device coordinates. The image is scaled into a square of size specified by destWidth and destHeight. The portion of the source image copied into that square is specified by srcX, srcY, srcWidth, and srcHeight.

protected void endDoc ()

Invoked by the RasterPrintJob super class this method is called after that last page has been imaged.

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

The RastePrintJob super class calls this method at the end of each page.

protected void fillPath ()

Fill the current path using the current fill mode and color.

protected int getCollatedCopies ()

Returns how many times the entire book should be printed by the PrintJob. If the printer itself supports collation then this method should return 1 indicating that the entire book need only be printed once and the copies will be collated and made in the printer.

protected int getNoncollatedCopies ()

Returns how many times each page in the book should be consecutively printed by PrintJob. If the printer makes copies itself then this method should return 1.

protected float getPenX ()

Return the x coordinate of the pen in the current path.

protected float getPenY ()

Return the y coordinate of the pen in the current path.

protected double getPhysicalPageHeight (Paper p)

Must be obtained from the current printer. Value is in device pixels. Not adjusted for orientation of the paper.

protected double getPhysicalPageWidth (Paper p)

Must be obtained from the current printer. Value is in device pixels. Not adjusted for orientation of the paper.

protected double getPhysicalPrintableHeight (Paper p)

Must be obtained from the current printer. Value is in device pixels. Not adjusted for orientation of the paper.

protected double getPhysicalPrintableWidth (Paper p)

Must be obtained from the current printer. Value is in device pixels. Not adjusted for orientation of the paper.

protected double getPhysicalPrintableX (Paper p)

For PostScript the origin is in the upper-left of the paper not at the imageable area corner.

protected double getPhysicalPrintableY (Paper p)

For PostScript the origin is in the upper-left of the paper not at the imageable area corner.

protected double getXRes ()

Return the x resolution of the coordinates to be rendered.

protected double getYRes ()

Return the y resolution of the coordinates to be rendered.

protected void lineTo (float x, float y)

Generate PostScript to draw a line from the current pen position to (x, y).

protected void moveTo (float x, float y)

Generate PostScript to move the current pen position to (x, y).

protected int platformFontCount (Font font, String str)

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

Prints the contents of the array of ints, 'data' to the current page. The band is placed at the location (x, y) in device coordinates on the page. The width and height of the band is specified by the caller. Currently the data is 24 bits per pixel in BGR format.

protected void selectClipPath ()

Intersect the gstate's current path with the current clip and make the result the new clip.

protected void setClip (Shape clip)

protected void setColor (Color color)

Set the printer's current color to be that defined by color

protected void setFillMode (int fillRule)

Set the current path rule to be either FILL_EVEN_ODD (using the even-odd file rule) or FILL_WINDING (using the non-zero winding rule.)

protected boolean setFont (Font font)

Set the current PostScript font. Taken from outFont in PSPrintStream.

protected void setTransform (AffineTransform transform)

protected void startDoc ()

Invoked by the RasterPrinterJob super class this method is called to mark the start of a document.

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

The RasterPrintJob super class calls this method at the start of each page.

protected boolean textOut (Graphics g, String str, float x, float y, Font mLastFont, FontRenderContext frc, float width)