Save This Page
Home » openjdk-7 » sun » awt » windows » [javadoc | source]
sun.awt.windows
public class: WPrinterJob [javadoc | source]
java.lang.Object
   java.awt.print.PrinterJob
      sun.print.RasterPrinterJob
         sun.awt.windows.WPrinterJob

All Implemented Interfaces:
    DisposerTarget

A class which initiates and executes a Win32 printer job.
Nested Class Summary:
static class  WPrinterJob.HandleRecord   
class  WPrinterJob.PrintToFileErrorDialog   
Field Summary
protected static final  long PS_ENDCAP_ROUND    These are Windows' ExtCreatePen End Cap Styles and must match the values in  
protected static final  long PS_ENDCAP_SQUARE     
protected static final  long PS_ENDCAP_FLAT     
protected static final  long PS_JOIN_ROUND    These are Windows' ExtCreatePen Line Join Styles and must match the values in  
protected static final  long PS_JOIN_BEVEL     
protected static final  long PS_JOIN_MITER     
protected static final  int POLYFILL_ALTERNATE    This is the Window's Polygon fill rule which Selects alternate mode (fills the area between odd-numbered and even-numbered polygon sides on each scan line). It must match the value in It can be passed to setPolyFillMode(). 
protected static final  int POLYFILL_WINDING    This is the Window's Polygon fill rule which Selects winding mode which fills any region with a nonzero winding value). It must match the value in It can be passed to setPolyFillMode(). 
Fields inherited from sun.print.RasterPrinterJob:
PRINTER,  FILE,  STREAM,  forcePDL,  forceRaster,  shapeTextProp,  sidesAttr,  destinationAttr,  noJobSheet,  mDestType,  mDestination,  collateAttReq,  landscapeRotates270,  attributes,  myService,  debugPrint
Constructor:
 public WPrinterJob() 
Method from sun.awt.windows.WPrinterJob Summary:
abortDoc,   beginPath,   beginPath,   closeFigure,   closeFigure,   createPathGraphics,   defaultPage,   deviceEndPage,   deviceStartPage,   drawDIBImage,   drawImage3ByteBGR,   endDoc,   endPage,   endPath,   endPath,   fillPath,   fillPath,   fillRect,   fillRect,   frameRect,   frameRect,   getCollatedCopies,   getDisposerReferent,   getGDIAdvance,   getNoncollatedCopies,   getPenX,   getPenX,   getPenY,   getPenY,   getPhysicalPageHeight,   getPhysicalPageWidth,   getPhysicalPrintableHeight,   getPhysicalPrintableWidth,   getPhysicalPrintableX,   getPhysicalPrintableY,   getPrintService,   getXRes,   getYRes,   glyphsOut,   initPrinter,   isCollated,   lineTo,   lineTo,   moveTo,   moveTo,   pageDialog,   polyBezierTo,   polyBezierTo,   printBand,   printDialog,   removeControlChars,   selectClipPath,   selectClipPath,   selectPen,   selectPen,   selectSolidBrush,   selectSolidBrush,   selectStylePen,   selectStylePen,   setAttributes,   setCopies,   setFont,   setFont,   setNativeCopies,   setPolyFillMode,   setPolyFillMode,   setPrintService,   setTextColor,   setTextColor,   startDoc,   startPage,   textOut,   textOut,   validatePaper
Methods from sun.print.RasterPrinterJob:
abortDoc,   cancel,   checkAllowedToPrintToFile,   createPathGraphics,   createPeekGraphics,   debug_println,   defaultPage,   endDoc,   endPage,   getCollatedCopies,   getCopies,   getCopiesInt,   getFirstPage,   getJobName,   getJobNameInt,   getLastPage,   getNoncollatedCopies,   getPageable,   getPhysicalPageHeight,   getPhysicalPageWidth,   getPhysicalPrintableHeight,   getPhysicalPrintableWidth,   getPhysicalPrintableX,   getPhysicalPrintableY,   getPrintService,   getPrinterGraphicsConfig,   getUserName,   getUserNameInt,   getXRes,   getYRes,   initPrinter,   initPrinterGraphics,   isCancelled,   isCollated,   isSupportedValue,   lookupDefaultPrintService,   pageDialog,   pageDialog,   print,   print,   printBand,   printDialog,   printDialog,   printPage,   removeControlChars,   saveState,   setAttributes,   setCollated,   setCopies,   setGraphicsConfigInfo,   setJobName,   setPageRange,   setPageable,   setPrintService,   setPrintable,   setPrintable,   startDoc,   startPage,   updatePageAttributes,   validatePage,   validatePaper
Methods from java.awt.print.PrinterJob:
cancel,   defaultPage,   defaultPage,   getCopies,   getJobName,   getPageFormat,   getPrintService,   getPrinterJob,   getUserName,   isCancelled,   lookupPrintServices,   lookupStreamPrintServices,   pageDialog,   pageDialog,   print,   print,   printDialog,   printDialog,   setCopies,   setJobName,   setPageable,   setPrintService,   setPrintable,   setPrintable,   validatePage
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.awt.windows.WPrinterJob Detail:
 protected native  void abortDoc()
    Call Window's AbortDoc routine to abort a print job.
 protected  void beginPath() 
 protected native  void beginPath(long printDC)
    Begin a Window's rendering path in the device context printDC.
 protected  void closeFigure() 
 protected native  void closeFigure(long printDC)
    Close a subpath in a Window's rendering path in the device context printDC.
 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 PathGraphics 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.
 public PageFormat defaultPage(PageFormat page) 
    The passed in PageFormat will be copied and altered to describe the default page size and orientation of the PrinterJob's current printer. Note: PageFormat.getPaper() returns a clone and getDefaultPage() gets that clone so it won't overwrite the original paper.
 protected native  void deviceEndPage(PageFormat format,
    Printable painter,
    int index)
    End a page. This call's Window's EndPage routine.
 protected native  void deviceStartPage(PageFormat format,
    Printable painter,
    int index,
    boolean paperChanged)
    Begin a new page. This call's Window's StartPage routine.
 protected  void drawDIBImage(byte[] image,
    float destX,
    float destY,
    float destWidth,
    float destHeight,
    float srcX,
    float srcY,
    float srcWidth,
    float srcHeight,
    IndexColorModel icm) 
 protected  void drawImage3ByteBGR(byte[] image,
    float destX,
    float destY,
    float destWidth,
    float destHeight,
    float srcX,
    float srcY,
    float srcWidth,
    float srcHeight) 
    Draw the 24 bit BGR image buffer represented by image to the GDI device context printDC. 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 native  void endDoc()
    Call Window's EndDoc routine to end a print job.
 protected  void endPage(PageFormat format,
    Printable painter,
    int index) 
    End a page.
 protected  void endPath() 
 protected native  void endPath(long printDC)
    End a Window's rendering path in the device context printDC.
 protected  void fillPath() 
 protected native  void fillPath(long printDC)
    Fill a defined Window's rendering path in the device context printDC.
 protected  void fillRect(float x,
    float y,
    float width,
    float height,
    Color color) 
 protected native  void fillRect(long printDC,
    float x,
    float y,
    float width,
    float height,
    int red,
    int green,
    int blue)
    Fill a rectangle specified by the coordinates using specified brush.
 protected  void frameRect(float x,
    float y,
    float width,
    float height) 
 protected native  void frameRect(long printDC,
    float x,
    float y,
    float width,
    float height)
    Draw a rectangle using specified brush.
 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.
 public Object getDisposerReferent() 
 protected int getGDIAdvance(String text) 
    Get the advance of this text that GDI returns for the font currently selected into the GDI device context for this job. Note that the removed control characters are interpreted as zero-width by JDK and we remove them for rendering so also remove them for measurement so that this measurement can be properly compared with JDK measurement.
 protected int getNoncollatedCopies() 
    Returns how many times each page in the book should be consecutively printed by PrinterJob. If the underlying Window's driver will generate the copies, rather than having RasterPrinterJob iterate over the number of copies, this method always returns 1.
 protected int getPenX() 
    Return the x coordinate of the current pen position in the print device context.
 protected native int getPenX(long printDC)
    Return the x coordinate of the current pen position in the device context printDC.
 protected int getPenY() 
    Return the y coordinate of the current pen position in the print device context.
 protected native int getPenY(long printDC)
    Return the y coordinate of the current pen position in the device context printDC.
 protected double getPhysicalPageHeight(Paper p) 
 protected double getPhysicalPageWidth(Paper p) 
 protected double getPhysicalPrintableHeight(Paper p) 
 protected double getPhysicalPrintableWidth(Paper p) 
 protected double getPhysicalPrintableX(Paper p) 
 protected double getPhysicalPrintableY(Paper p) 
 public PrintService getPrintService() 
 protected double getXRes() 
 protected double getYRes() 
 protected  void glyphsOut(int[] glyphs,
    float x,
    float y,
    float[] positions) 
    Draw the glyphs glyphs to the printer's device context at the specified position.
 protected native  void initPrinter()
 protected boolean isCollated() 
    We don't (yet) provide API to support collation, and when we do the logic here will require adjustment, but this method is currently necessary to honour user-originated collation requests - which can only originate from the print dialog. REMIND: check if this can be deleted already.
 protected  void lineTo(float x,
    float y) 
 protected native  void lineTo(long printDC,
    float x,
    float y)
    Draw a line from the current pen position to (x,y) in the device context printDC.
 protected  void moveTo(float x,
    float y) 
 protected native  void moveTo(long printDC,
    float x,
    float y)
    Move the Window's pen position to (x,y) in the device context printDC.
 public PageFormat pageDialog(PageFormat page) throws HeadlessException 
    Display a dialog to the user allowing the modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog, then the method returns the original page object unmodified. If the user okays the dialog then the method returns a new PageFormat object with the indicated changes. In either case the original page object will not be modified.
 protected  void polyBezierTo(float control1x,
    float control1y,
    float control2x,
    float control2y,
    float endX,
    float endY) 
 protected native  void polyBezierTo(long printDC,
    float control1x,
    float control1y,
    float control2x,
    float control2y,
    float endX,
    float endY)
 protected native  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. 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.
 public boolean printDialog() throws HeadlessException 
    Presents the user a dialog for changing properties of the print job interactively.
 protected String removeControlChars(String str) 
    Remove control characters.
 protected  void selectClipPath() 
    Set the current path in the printer device's context to be clipping path.
 protected native  void selectClipPath(long printDC)
    Select the device context's current path to be the clipping path.
 protected  void selectPen(float width,
    Color color) 
 protected native  void selectPen(long printDC,
    float width,
    int red,
    int green,
    int blue)
    Create a solid brush using the RG & B colors and width. Select this brush and delete the old one.
 protected  void selectSolidBrush(Color color) 
 protected native  void selectSolidBrush(long printDC,
    int red,
    int green,
    int blue)
    Create a Window's solid brush for the color specified by (red, green, blue). Once the brush is created, select it in the device context printDC and free the old brush.
 protected boolean selectStylePen(int cap,
    int join,
    float width,
    Color color) 
 protected native boolean selectStylePen(long printDC,
    long cap,
    long join,
    float width,
    int red,
    int green,
    int blue)
    Create a solid brush using the RG & B colors and specified pen styles. Select this created brush and delete the old one.
 protected  void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException 
    copy the attributes to the native print job Note that this method, and hence the re-initialisation of the GDI values is done on each entry to the print dialog since an app could redisplay the print dialog for the same job and 1) the application may have changed attribute settings 2) the application may have changed the printer. In the event that the user changes the printer using the dialog, then it is up to GDI to report back all changed values.
 public  void setCopies(int copies) 
    Set the number of copies to be printed.
 protected boolean setFont(String family,
    float size,
    int style,
    int rotation,
    float awScale) 
    Set a GDI font capable of drawing the java Font passed in.
 protected native boolean setFont(long printDC,
    String familyName,
    float fontSize,
    boolean bold,
    boolean italic,
    int rotation,
    float awScale)
    Set a GDI font capable of drawing the java Font passed in.
 public native  void setNativeCopies(int copies)
    Set copies in device.
 protected  void setPolyFillMode(int fillRule) 
    Set the current polgon fill rule into the printer device context. The fillRule should be one of the following Windows constants: ALTERNATE or WINDING.
 protected native  void setPolyFillMode(long printDC,
    int fillRule)
    Set the current polgon fill rule into the device context printDC. The fillRule should be one of the following Windows constants: ALTERNATE or WINDING.
 public  void setPrintService(PrintService service) throws PrinterException 
    Associate this PrinterJob with a new PrintService. Throws PrinterException if the specified service cannot support the Pageable and Printable interfaces necessary to support 2D printing.
 protected  void setTextColor(Color color) 
    Set the GDI color for text drawing.
 protected native  void setTextColor(long printDC,
    int red,
    int green,
    int blue)
    Set the GDI color for text drawing.
 protected  void startDoc() throws PrinterException 
 protected  void startPage(PageFormat format,
    Printable painter,
    int index,
    boolean paperChanged) 
    Begin a new page.
 protected  void textOut(String str,
    float x,
    float y,
    float[] positions) 
    Draw the string text to the printer's device context at the specified position.
 protected native  void textOut(long printDC,
    String text,
    int strlen,
    boolean glyphs,
    float x,
    float y,
    float[] positions)
    Draw the string text into the device context printDC at the specified position.
 protected native  void validatePaper(Paper origPaper,
    Paper newPaper)
    validate the paper size against the current printer.