print directly to printer on server (xamarin C#)
-
I want to add a method by which I can directly print report from the printer on local network. my server which printer is connected to is 192.168.1.50 (my printer isnt Bluetooth OR Wifi one.) I also have seen PrinterShare but it looks like it requires a client software running on a PC connected to the printer. I wanna to do it directly to server which has printer connected and shared! I got this code but no USE!!! I wanna to do that in (xamarin C#) try { Socket sock = new Socket("192.168.1.222", 9100); PrintWriter oStream = new PrintWriter(sock.getOutputStream()); oStream.println("HI,test from Android Device"); oStream.println("\n\n\n"); oStream.close(); sock.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Thanks in advacned!
-
I want to add a method by which I can directly print report from the printer on local network. my server which printer is connected to is 192.168.1.50 (my printer isnt Bluetooth OR Wifi one.) I also have seen PrinterShare but it looks like it requires a client software running on a PC connected to the printer. I wanna to do it directly to server which has printer connected and shared! I got this code but no USE!!! I wanna to do that in (xamarin C#) try { Socket sock = new Socket("192.168.1.222", 9100); PrintWriter oStream = new PrintWriter(sock.getOutputStream()); oStream.println("HI,test from Android Device"); oStream.println("\n\n\n"); oStream.close(); sock.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Thanks in advacned!
-
jojoba20 wrote:
I got this code but no USE!!!
You need to explain why it is no use. Did you get some sort of error, and if so please edit your question and add the details.
-
jojoba20 wrote:
it needs wifi printer but mine is only connected to PC
I don't think there is a lot that we can do to help with that.
-
thanks for reply do u have any example for what i wanna do? forget what i have searched! thnaks in advanced
-
I want to add a method by which I can directly print report from the printer on local network. my server which printer is connected to is 192.168.1.50 (my printer isnt Bluetooth OR Wifi one.) I also have seen PrinterShare but it looks like it requires a client software running on a PC connected to the printer. I wanna to do it directly to server which has printer connected and shared! I got this code but no USE!!! I wanna to do that in (xamarin C#) try { Socket sock = new Socket("192.168.1.222", 9100); PrintWriter oStream = new PrintWriter(sock.getOutputStream()); oStream.println("HI,test from Android Device"); oStream.println("\n\n\n"); oStream.close(); sock.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Thanks in advacned!
Check out the article I wrote on printing from an Android app developed using Xamarin. Printing from a Xamarin.Android Application Developed with Visual Studio[^]