How do I send csv/text file from an Android phone to a wifi printer?

前端 未结 4 1810
心在旅途
心在旅途 2021-02-03 12:06

I am developing an Android application were I am supposed to get the data from a database in csv/txt file format and later I have to send the files to a wifi printer.

Do

4条回答
  •  粉色の甜心
    2021-02-03 12:28

    The answer was finally easy :

     Socket client = new Socket(_IP, PORT);
    
     oStream = new PrintStream(client.getOutputStream(), true, "UTF-8");
    
     oStream.println("-------------------------------------------------\r\n");
     oStream.println(" NAME     : DEMO CLIENT\r\n");
    oStream.println(" CODE  : 00000234242\r\n");
    oStream.println(" ADDRESS   : Street 52\r\n");
    oStream.println(" Phone : 2310-892345\r\n");
    oStream.println("-------------------------------------------------\r\n");
    
    oStream.flush();
    
    oStream.close();
    client.close(); 
    

提交回复
热议问题