title: iText direct Printing
body: <p>I am using iText  to generate a pdf and write it to the file system as the following:</p>
  
  <pre><code>private void createPDF() throws Exception{
      com.itextpdf.text.Document doc = new com.itextpdf.text.Document();
      PdfWriter docWriter = null;
      path = "C:\\PATH\\TO\\Desktop\\EXAMPLE_FOLDER\\" + pdfFilename;
      docWriter = PdfWriter.getInstance(doc, new FileOutputStream(path));
      doc.addTitle("Invoice");
      doc.setPageSize(PageSize.A4);
      doc.open();
      PdfContentByte cb = docWriter.getDirectContent();
      fillPDFDetails(cb);
      if (doc != null) {
          doc.close();
      }
      if (docWriter != null) {
          docWriter.close();
      }
  }
  </code></pre>
  
  <p>However, I want to send the pdf to the printer and print the pdf file instead of writing it to the file system. How can I achieve this?</p>