Hi - I have some problems with printing. I made simple report, that needs to be printed. Everything was ok till I changed the printer - the printout doesn't fit the paper it's twice bigger. I have a class that implements Printeable interface:

Java Code:
@Override
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
[...]
        Graphics2D g2d = (Graphics2D)g;

        g2d.translate((int) pf.getImageableX(), (int) pf.getImageableY());
        width = (int) pf.getImageableWidth();
        height = (int) pf.getImageableHeight();
        g2d.setClip(0, 0, width, height);
[...]
When I was testing printing using PDFPrinter the problem also exists. For 600dpi printout look ok but for 300dpi the printout is two times bigger and doesn't fit the paper. Scaling is not a problem - I can use g2d.scale( xfactor, yfactor) - but I don't know how to find factor - how to get value of dpi for current PrintJob? Does anyone know solution? It would be greatly appreciated.
Greetings...