The java printing code is working,send to printer but not print anything(java in python)
Question: i have made various research on this,plus,i'm using python,which i actually
implement java in python script.Somehow,the record is send to the printer(i
even got the message about this)but it does not print.can anyone help me on
this,i'm stuck on this.thanks.

This is the code,i got no error for this.

    
    
    import system
    import javax.print
    import java.io
    from java.lang import Thread
    
    filestream = java.io.BufferedInputStream(java.io.FileInputStream("C:/GEEKS.txt"))
    
    psInformat = javax.print.DocFlavor.INPUT_STREAM.AUTOSENSE
    
    myDoc = javax.print.SimpleDoc(filestream,psInformat,None)
    
    aset = javax.print.attribute.HashPrintRequestAttributeSet()
    aset.add(javax.print.attribute.standard.Copies(2))
    
    services = javax.print.PrintServiceLookup.lookupDefaultPrintService()
    
    job = services.createPrintJob()
    
    job.print(myDoc, None)
    
    Thread.sleep(20000)
    
    filestream.close()
    


Answer: You are trying to send a .docx file to the printer; the print service almost
certainly doesn't know how to render and print a .docx file. Try sending a
plain text file.

