View RSS Feed

Java AWT

Java Abstract Window Toolkit (AWT)

  1. Printing a Multiple Page Document

    by , 03-07-2012 at 05:11 PM
    To print number of graphic images, page index is used so that to iterate via pages & print just 1 at every page. E.g, many images are presented in this array:
    Java Code:
    BufferedImage[] images = new BufferedImage[10];
    Then, use the print() method as in the following code fragment:
    public int print(Graphics graphics,
               PageFormat pageFormat, int pageIndex)
               throws PrinterException {
    
        if (pageIndex < images.length) {
    ...