src/share/classes/java/awt/print/Printable.java

Print this page




  77  * collated copies, the increasing page index order means that when
  78  * page N is requested if a client needs to calculate page break position,
  79  * it may safely discard any state related to pages < N, and make current
  80  * that for page N. "State" usually is just the calculated position in the
  81  * document that corresponds to the start of the page.
  82  *
  83  * <li>When called by the printing system the <code>Printable</code> must
  84  * inspect and honour the supplied PageFormat parameter as well as the
  85  * page index.  The format of the page to be drawn is specified by the
  86  * supplied PageFormat. The size, orientation and imageable area of the page
  87  * is therefore already determined and rendering must be within this
  88  * imageable area.
  89  * This is key to correct printing behaviour, and it has the
  90  * implication that the client has the responsibility of tracking
  91  * what content belongs on the specified page.
  92  *
  93  * <li>When the <code>Printable</code> is obtained from a client-supplied
  94  * <code>Pageable</code> then the client may provide different PageFormats
  95  * for each page index. Calculations of page breaks must account for this.
  96  * </ul>
  97  * <p>
  98  * @see java.awt.print.Pageable
  99  * @see java.awt.print.PageFormat
 100  * @see java.awt.print.PrinterJob
 101  */
 102 public interface Printable {
 103 
 104     /**
 105      * Returned from {@link #print(Graphics, PageFormat, int)}
 106      * to signify that the requested page was rendered.
 107      */
 108     int PAGE_EXISTS = 0;
 109 
 110     /**
 111      * Returned from <code>print</code> to signify that the
 112      * <code>pageIndex</code> is too large and that the requested page
 113      * does not exist.
 114      */
 115     int NO_SUCH_PAGE = 1;
 116 
 117     /**




  77  * collated copies, the increasing page index order means that when
  78  * page N is requested if a client needs to calculate page break position,
  79  * it may safely discard any state related to pages &lt; N, and make current
  80  * that for page N. "State" usually is just the calculated position in the
  81  * document that corresponds to the start of the page.
  82  *
  83  * <li>When called by the printing system the <code>Printable</code> must
  84  * inspect and honour the supplied PageFormat parameter as well as the
  85  * page index.  The format of the page to be drawn is specified by the
  86  * supplied PageFormat. The size, orientation and imageable area of the page
  87  * is therefore already determined and rendering must be within this
  88  * imageable area.
  89  * This is key to correct printing behaviour, and it has the
  90  * implication that the client has the responsibility of tracking
  91  * what content belongs on the specified page.
  92  *
  93  * <li>When the <code>Printable</code> is obtained from a client-supplied
  94  * <code>Pageable</code> then the client may provide different PageFormats
  95  * for each page index. Calculations of page breaks must account for this.
  96  * </ul>

  97  * @see java.awt.print.Pageable
  98  * @see java.awt.print.PageFormat
  99  * @see java.awt.print.PrinterJob
 100  */
 101 public interface Printable {
 102 
 103     /**
 104      * Returned from {@link #print(Graphics, PageFormat, int)}
 105      * to signify that the requested page was rendered.
 106      */
 107     int PAGE_EXISTS = 0;
 108 
 109     /**
 110      * Returned from <code>print</code> to signify that the
 111      * <code>pageIndex</code> is too large and that the requested page
 112      * does not exist.
 113      */
 114     int NO_SUCH_PAGE = 1;
 115 
 116     /**