WindowsPrinter
port=new WindowsPrinter("HP LaserJet 2100"); // name of printer
in windows control panel
TextPrinter
printer=PrinterFactory.getPrinter("HP-PCL"); // get
printer supporting HP-PCL command set
// create printing job
JobProperties job= printer.getDefaultJobProperties();
job.landscape=true;
printer.startJob(port,job);
// print BOLD
text
prop=printer.getDefaultTextProperties();
prop.bold=true;
printer.printString("This must be BOLD",prop);
printer.newLine();
// print line
printer.printHorizontalLine(5,0,80); // row 5, column 0 to 80
printer.endJob();