Posted By:
Sachin_Patil
Posted On:
Wednesday, May 16, 2001 11:37 PM
Code below should solve your problem:
import java.awt.print.*;
public class PrintProfile {
public PrintProfile() {
}
public void pagePrint(){
try {
PrinterJob printerJob = PrinterJob.getPrinterJob();
PageFormat formating = new PageFormat();
formating = printerJob.pageDialog(formating);
printerJob.setJobName("c:\sachin.txt");
boolean doPrint = printerJob.printDialog();
if (doPrint)
printerJob.print();
}
catch (PrinterException exception){
System.err.println("Printing error: " +exception);
}
}
}