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);