title: Print a PDF file to a printer using PrintWriter via Socket connection
body: <p>I have to print a pdf file using a printer with a specific IP address. I am able to print a specific text but I want to print a file or a html parsed text.</p>
  <p>My Code:</p>
  <pre><code>try {
      Socket sock = new Socket(&quot;192.168.0.131&quot;, 9100);
      PrintWriter oStream = new PrintWriter(sock.getOutputStream());
      oStream.println(&quot;HI,test from Android Device&quot;);
      oStream.println(&quot;\n\n\n&quot;);
      oStream.close();
      sock.close();
  } catch (UnknownHostException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>
  <p>Many people are suggesting about PDLs but how to convert the pdf to PDL?</p>