public class Class3 { public static void main(String[] args) throws PrintException, IOException { DocFlavor docFlavor = DocFlavor.INPUT_STREAM.AUTOSENSE; PrintService printService = PrintServiceLookup.lookupDefaultPrintService(); InputStream inputStream = new FileInputStream("example.txt"); PrintRequestAttributeSet attrib = new HashPrintRequestAttributeSet(); attrib.add(new Copies(1)); Doc doc = new SimpleDoc(inputStream, docFlavor, null); DocPrintJob docPrintJob = printService.createPrintJob(); docPrintJob.print(doc, attrib); } } I try to print the file, everything works out without errors, Process finished with exit code 0 but the file does not print .
the printer is working, the file is printed using standard windows tools.
I looked through the entire Internet, copied many examples, the result is one.
What could be the problem?