imprima una imagen con tamaño real en java
Bueno, tengo una imagen y quiero imprimirla exactamente en tamaño real en papel e implementada debajo del código, pero no sé por qué este código amplía la imagen, pero quiero que la imagen mantenga su tamaño, ¿podrían ayudarme?
Muchas gracias ..
final Image img = new ImageIcon("C:\\check.jpg").getImage();
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(new Printable()
{
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
if (pageIndex != 0) {
return NO_SUCH_PAGE;
}
graphics.drawImage(img, 0, 0, img.getWidth(null), img.getHeight(null), null);
return PAGE_EXISTS;
}
});
if (printJob.printDialog()) {
try {
printJob.print();
} catch (Exception prt) {
System.err.println(prt.getMessage());
}
}