title: Printing a byte array to thermal printer Java
body: <p>I am using java application to make web service call to FedEx and trying to print the label to a local USB connected thermal printer.
  I will get byte array from FedEx as response and want to print this to client machine where the thermal printer connected</p>
  
  <pre><code>DocAttributeSet das = new HashDocAttributeSet();
  PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
  
  PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
  DocPrintJob job = ps.createPrintJob();
  Doc doc = new SimpleDoc(image, DocFlavor.BYTE_ARRAY.AUTOSENSE, das);    
  job.print(doc, pras);
  </code></pre>
  
  <p>Your help is highly appreciated, or suggest me/redirect me to a link where I can find solution.</p>
  
  <p><strong>UPDATE:</strong> I want to Print the FedEx label onto a locally USB connected thermal printer from a web based application. </p>
  
  <p>I have the server code written as above, I am facing issue to print the label locally. </p>
  
  <p>The above code is looking for a printer connected on the application server. </p>
  
  <p>When client is clicking on "Print Label" button, the FedEx webservice call is success and returning the ZPLII format byte array correctly but <strong>"want to push this byte array to client machine and print to the thermal Printer"</strong>. </p>
  
  <p>Only until getting the byte array back from FedEx is working after that nothing I could able to implement to bring the byte array back to printer to print on thermal printer.</p>