tags:

views:

365

answers:

2

Hi,

I want to generate a .prn file using Java.

  1. Is there any java api already available ?
  2. 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).
  3. If there is no API available whats the strategy to generate the .PRN file ?
A: 

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.

Charlie Martin
+1  A: 

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.

Thorbjørn Ravn Andersen