When I print images it seems like zoomed in the result page. But there is normal scaling when we'll try to save image to file.
How can I print images in original scale?
There is a sample code:
@Override
public int print(Graphics graphics, PageFormat pageFormat, int page) throws PrinterException {
if(page < sequence.size()) {
BufferedImage image = sequence.get(page).getImage();
String filename = ((Integer)page).toString()+".png";
File outputFile = new File(filename);
try {
ImageIO.write(image, "png", outputFile);
} catch (IOException e) {
e.printStackTrace();
}
graphics.drawImage(image, (int)pageFormat.getImageableX(), (int)pageFormat.getImageableY(), null);
return PAGE_EXISTS;
} else {
return NO_SUCH_PAGE;
}
}