| Button | Function |
| Read .HTML file | Opens a file dialog, read .html file into display window |
| Print Preview | Opens the standard J2PrinterWorks print preview dialog |
| Print to PDF File |
Prompts for a file name and calls the method
printToPDF(fileName") |
| Display PDF File | Prompts for a file name and
calls the method displayPDFFile(fileName") |
| Print PDF File | Prompts for a file name and
calls the method printToPDF(fileName") |
J2Printer printer = new J2Printer(); |
J2TextPrinter textPrinter = new
J2TextPrinter(yourJTextPane); |
printer.addPageable(textPrinter); |
printer.setLeftMargin(.25); |
printer.setRightMargin(.25); |
printer.setTopMargin(.25); |
printer.setBottomMargin(.25); |
printer.printToPS("printout.pdf"); |
J2Printer14 printer = new J2Printer14(); |
String[] printers = printer.getPrinterNames(); // find
all printier names |
printer.setPrinter(printers[i]);
// specify some printer "i" |
printer.printPDFFile("file.pdf");
// print existing "file.pdf" |
| public class MyPrinterJob extends sun.awt.windows.WPrinterJob { |
| public MyPrinterJob() { super();} |
| public PageFormat validatePage(PageFormat pageFormat) { return pageFormat; } // return page format unchanged |
| } |
| ... |
| printer = new J2Printer("your-serial-number", new MyPrinterJob()); |