Print Large Image

P

Patrick Boulay

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top