title: how to send a .text file containing ESC/POS commands to a printer from java code
body: <p>What i have so far is the following code:</p>
  
  <pre><code> FileInputStream fin =new FileInputStream(filename);
   DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;                    
   Doc d = new SimpleDoc(fin, df, null);   
   PrintService P = PrintServiceLookup.lookupDefaultPrintService();
  
    if (P != null) {              
       DocPrintJob job = P.createPrintJob();  
       job.print(d, null);  
              }
      fin.close;
  </code></pre>
  
  <p>the code is working fine but the printer does't interpret the commands if the file containing commands, it keep printing the exact string content of the file.
  so how to send command to Epson receipt printer ? </p>