title: JavaFX : Image getting scaled to 25% and then getting printed.
body: <p>I am trying to print an image using JavaFX api's. Unfortunately, it is cutting a part of the image, approximately 25% and then stretching that to the entire A4 page, and printing it. What am I doing wrong with the print code. How can I instruct to fit the image to page for printing, no matter what the printer is. Kindly let me know.</p>
  
  <p>Code :</p>
  
  <pre><code> public void printThis() {
  
          System.out.println("I was called");
          // note you can use overloaded forms of the Image constructor
          // if you want to scale, etc
          String path = "resources/img/printouts/image.png";
          Image image = new Image(getClass().getResource(path).toExternalForm());
          ImageView imageView = new ImageView(image);
          new Thread(() -&gt; printImage(imageView)).start();
      }
  
      public void printImage(ImageView image) {
          Printer printer = Printer.getDefaultPrinter();
          PrinterJob printJob = PrinterJob.createPrinterJob(printer);
          PageLayout pageLayout = printJob.getJobSettings().getPageLayout();
          //PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT);
          printJob.getJobSettings().setPageLayout(pageLayout);
          if (printJob != null) {
              boolean success = printJob.printPage(image);
              if (success) {
                  printJob.endJob();
              }
          }
      }
  </code></pre>
  
  <p>Kindly let me know what am I doing wrong. Thank you. :-)</p>