public class DrawingPageable
extends java.lang.Object
implements java.awt.print.Pageable
DrawingPageable
can be used to print a Drawing
using the
java.awt.print API.
Usage:
Pageable pageable = new DrawingPageable(aDrawing); PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(pageable); if (job.printDialog()) { try { job.print(); } catch (PrinterException e) { ...inform the user that we couldn't print... } }
PrintFileAction
Constructor and Description |
---|
DrawingPageable(Drawing drawing)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfPages() |
java.awt.print.PageFormat |
getPageFormat(int pageIndex) |
java.awt.print.Printable |
getPrintable(int pageIndex) |
int |
printPage(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
protected void |
setRenderingHints(java.awt.Graphics2D g) |
public DrawingPageable(Drawing drawing)
public int getNumberOfPages()
getNumberOfPages
in interface java.awt.print.Pageable
public java.awt.print.PageFormat getPageFormat(int pageIndex) throws java.lang.IndexOutOfBoundsException
getPageFormat
in interface java.awt.print.Pageable
java.lang.IndexOutOfBoundsException
public java.awt.print.Printable getPrintable(int pageIndex) throws java.lang.IndexOutOfBoundsException
getPrintable
in interface java.awt.print.Pageable
java.lang.IndexOutOfBoundsException
public int printPage(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex) throws java.awt.print.PrinterException
java.awt.print.PrinterException
protected void setRenderingHints(java.awt.Graphics2D g)