How to set DocFlavor for printservice in Java for WIndows
<p>I have written code to run the printer programatically in Java.I have to set the value of docflavor to print the .txt file.When I set it for INPUT_STREAM.TEXT_PLAIN_UTF_8 and run my program on Linux , it prints the text file.but when i run the same code for windows.It can't print the text file.It only prints the jpeg format file.I am using HP Deskjet F735 printer for this. Following is my code .</p>

<pre><code>            DocFlavor docflavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8;

            PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();

            attr_set.add(new Copies(2));

  PrintService[] service = PrintServiceLookup.lookupPrintServices(docflavor, attr_set);

             if (service.length==0) {
                    JOptionPane.showMessageDialog(null, "No Printer Selected");
                }

            else if (service.length &gt; 0) {
                System.out.println("Selected printer is " + service[0].getName());

                    DocPrintJob pj = service[0].createPrintJob();
                    {
                        PrintService ps = pj.getPrintService();
                        FileInputStream fis = null;
                        try {
                            File file = new File("/home/ignu/Desktop/newfile");
                            fis = new FileInputStream(file);
                            Doc doc = new SimpleDoc(fis, docflavor, null);
                            pj.print(doc, attr_set);
</code></pre>
