Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. print directly to printer on server (xamarin C#)

print directly to printer on server (xamarin C#)

Scheduled Pinned Locked Moved Android
sysadmincsharpandroidmobile
7 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jojoba20
    wrote on last edited by
    #1

    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!

    L D 2 Replies Last reply
    0
    • J jojoba20

      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!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      J 1 Reply Last reply
      0
      • L Lost User

        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.

        J Offline
        J Offline
        jojoba20
        wrote on last edited by
        #3

        it needs wifi printer but mine is only connected to PC(server) and the printer is shared

        L 1 Reply Last reply
        0
        • J jojoba20

          it needs wifi printer but mine is only connected to PC(server) and the printer is shared

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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.

          J 1 Reply Last reply
          0
          • L Lost User

            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.

            J Offline
            J Offline
            jojoba20
            wrote on last edited by
            #5

            thanks for reply do u have any example for what i wanna do? forget what i have searched! thnaks in advanced

            L 1 Reply Last reply
            0
            • J jojoba20

              thanks for reply do u have any example for what i wanna do? forget what i have searched! thnaks in advanced

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              See my previous answer.

              1 Reply Last reply
              0
              • J jojoba20

                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!

                D Offline
                D Offline
                Dominic Burford
                wrote on last edited by
                #7

                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[^]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups