swing - Java printer api -


I should stand alone for a medical store with Java swing. A print of a chit with a small size (21 9 mm to 140 mm) with one click without the print dialogue is mandatory, they are required to monthly report a full A4 pages report from a different printer.

Is it possible to change printer and paper properties in Java applications with Java SE without bringing printer dialogs?

PrintService An example from the javadoc of the interface

< Pre> DocFlavor taste = DocFlavor.INPUT_STREAM.POSTSCRIPT; PrintRequestAttributeSet aset = New HashPrintRequestAttributeSet (); Aset.add (MediaSizeName.ISO_A4); PrintService [] pservices = PrintServiceLookup.lookupPrintServices (tastes, aset); If (pservices.length & gt; 0) {DocPrintJob pj = pservices [0] .createPrintJob (); {FileInputStream fis = Try New FileInputStream ("test.ps"); Doctor doctor = new simpler (FIS, taste, blank); Pj.print (doctor, aset); } Catch (FileNotFoundException fe) {} Catch (Print Exception E) {}}

You can get all the available PrintServices and print it with the desired format.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -