问题
I want to generate a .prn file using Java.
- Is there any java api already available ?
- Is there any value in generating a .PRN file now-a-days (Mine is a web based application trying to mimic the existing client/ server application functionality. The current fat client application is pretty old).
- If there is no API available whats the strategy to generate the .PRN file ?
回答1:
A PRN is the byte stream which would be sent to the printer to generate the output, and is generated by the printer driver. Postscript printers get PostScript and HP printers usually get PCL etc.
In order to replicate the behaviour you need a compatible driver in the Java Printing Service
http://java.sun.com/javase/technologies/desktop/printing/
See http://www.exampledepot.com/egs/javax.print/pkg.html for some short sample programs, and investigate what printers you have available on the system.
回答2:
A prn file is printer specific; it's just Windows' way of intercepting the output sent to a print for printing later. Regular Java printing can be directed to a file.
来源:https://stackoverflow.com/questions/757004/prn-file-generation