title: PDF Java print : job sent in printer jobs queue but nothing prints
body: <p>I am trying to print a PDF document.<br>
  I can see the job in the printer queue, and then I see it disappear, like if the printer had finished its job. </p>
  
  <p>But the problem is that nothing is printing.
  I can't figure out what is wrong in my code.</p>
  
  <pre><code>PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null,null);
  PrintService service = null;
  for (String imprimante : listImprimantes){
      for( PrintService printService : printServices ) {
          Attribute[] attrs = printService.getAttributes().toArray();
          for (int j=0; j&lt;attrs.length; j++) {
              String attrName = attrs[j].getName();
              String attrValue = attrs[j].toString();
              if (attrName.equals("printer-info")){
                  if (attrValue.equals(imprimante)){
                      service = printService;
                      DocFlavor[] flavors = service.getSupportedDocFlavors();
                      break;
                  }
              }
          }
      }
  }
  InputStream fi = new ByteArrayInputStream(baos.toByteArray());
  
  DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
  DocPrintJob printJob = service.createPrintJob();
  Doc doc = new SimpleDoc(fi, flavor, null);
  try {
      if (doc != null) {
          printJob.print(doc, null);
      }
  } 
  catch (PrintException e1) {
      log.debug(e1.getMessage());
  }
  </code></pre>
  
  <p>If anyone can help me on this...</p>