print a image with actual size in java -


Well I have a picture and I want to print it in real size on paper and under code Is implemented but I do not know how this code zooms but I want to keep its shape, can you help me?

Thanks a lot ...

  final image img = new ImageIcon ("C: \\ check.jpg") getImage () ;. Printer Job printJob = PrinterJob.getPrinterJob (); PrintJob.setPrintable throws PrinterException (new printable) {Public Int Print (Graphics Graphics, Page Format Page Format, Int page Index) {if (pageIndex! = 0) {return NO_SUCH_PAGE;} graphics.drawImage (img, 0, 0) , Img.getWidth (faucet), imgghetheit (faucet), empty); return PAGE_EXISTS;}}); If (printJob.printDialog ()) {try {printJob.print (); } Hold (exception primarily) {System.err.println (prt.getMessage ()); }}    

That's because the correct resolution of your image is not Google One inch dots Take a look at a "image resolution, one" then a javadoc, which clearly uses a resolution of 72 dpi. Now you should have enough information to properly scale your image.

Comments