title: How to open a pdf and respective print dialogbox on a single action (button click) without showing pdf on web screen?
body: <p>I need to print a pdf on my action. 
  On a single button click I want to generate a pdf without showing it on web screen and simultaneously pop up print dialogue box to print that pdf. Currently, this scenario is perfectly working on my local machine, but whenever any other system tries to access my machine (using my URL i.e. <a href="http://myMchineIPaddress:8081/" rel="nofollow noreferrer">http://myMchineIPaddress:8081/</a>) then print dialogue box is poped up on my machine and not from the machine who is actually giving the print command.</p>
  
  <p>Is there any way to open print dialogue box on machine from which print command is actually given ?</p>
  
  <p>Below is the code which I am using:</p>
  
  <pre><code>// configurePrinterJob
              PrinterJob printerJob = PrinterJob.getPrinterJob();
              Book book = new Book();
              PageFormat documentPageFormat = new PageFormat();
              documentPageFormat.setOrientation(PageFormat.LANDSCAPE);
              book.append(subpdfDocument.getPrintable(0), documentPageFormat);
              printerJob.setPageable(book);
  
              PrintService printService = PrintServiceFinder.findPrintService(printer);
              if (printService != null) {
                  printerJob.setPrintService(printService);
              } else {
                  logger.warn("[PRINT] - Printer not found in the printerlist");
              }
  
              subpdfDocument.print(printerJob);
              subpdfDocument.close();
  
   public void print(PrinterJob printJob) throws PrinterException
  {
      print(printJob, false);
  }
  
  
  private void print(PrinterJob job, boolean silent) throws PrinterException {
      if (job == null) {
          throw new PrinterException("The given printer job is null.");
      } else {
          job.setPageable(new PDPageable(this, job));
          if (silent || job.printDialog()) {
              job.print();
          }
      }
  }
  </code></pre>