Print Large Image

Discussion in 'Java' started by Patrick Boulay, Feb 4, 2004.

  1. Hi,

    I load a TIFF file into a Image object with the dimension 1680x2171. I
    want to print it and fit on page on my print in the printer resolution
    (like my printer 600 dpi).

    I try a lot of different way... I got a lot of problem...

    I print a little part of the picture (because the image it's too big).
    If I scale it, I lose quality.

    Look my code:

    public void doprint() {
    PrinterJob printJob = PrinterJob.getPrinterJob();
    PageFormat pf = printJob.defaultPage();
    printJob.setPrintable(this,pf);
    if (printJob.printDialog()) {
    try {
    printJob.print();
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    }



    public int print(Graphics g, PageFormat pageFormat, int pi) throws
    PrinterException {
    if (pi >= 1) {
    return Printable.NO_SUCH_PAGE;
    }

    Graphics2D g2d = (Graphics2D)g;
    g2d.drawImage(_image, 0, 0,this);

    print(g2d);
    return Printable.PAGE_EXISTS;
    }



    Anyone can help me?

    Patrick
     
    Patrick Boulay, Feb 4, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Clive Moore

    large print files

    Clive Moore, Feb 25, 2004, in forum: Java
    Replies:
    0
    Views:
    321
    Clive Moore
    Feb 25, 2004
  2. keto
    Replies:
    0
    Views:
    1,024
  3. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    390
    David Cournapeau
    Dec 30, 2008
  4. Ketchup
    Replies:
    1
    Views:
    273
    Jan Tielens
    May 25, 2004
  5. Replies:
    5
    Views:
    957
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page