final long pdc = WinPrinterFactory.getPrinterDC(
service.printerName, service.getPrinterProps()
.getStructPtr());
final double xRes = WinPrinterFactory.getPixelsPerInchX(pdc) / 72;
final double yRes = WinPrinterFactory.getPixelsPerInchY(pdc) / 72;
final Graphics2D g2d = new WinGDIPGraphics2D(pdc, (char) 2,
(int) (format.getWidth() * xRes), (int) (format
.getHeight() * yRes));
try {
startJob(pdc, getDocName(img, attributes),
getDestinationPath(attributes));
WinPrinterFactory.startPage(pdc);
g2d.drawImage(img, (int) (format.getImageableX() * xRes),
(int) (format.getImageableY() * yRes),
(int) (format.getImageableWidth() * xRes),
(int) (format.getImageableHeight() * yRes),
Color.WHITE, null);
WinPrinterFactory.endPage(pdc);