Set printing properties with printJob?

zhaozj2021-02-16  55

1. Need a print service object. This can be implemented in three ways: the version before JDK1.4, you must implement the java.awt.print.printable interface or through Toolkit.getDefaultToolkit (). GetPrintJob to get the print service object; you can also in JDK1.4. Locate a print service object by javax.print.printserivcelookup.

2, you need to start a print job. This also has several implementation methods: You can start printing in java.awt.print.printJob before JDK1.4, now it is rarely used, and now you can also pass Java.Awt .print.printerjob's PrintDialog Displays the print dialog box and then starts printing by the Print method; in JDK1.4, you can display the print dialog through the Javax.Print.Serviceui's PrintDialog, and then call the print method to start a print job. Set print properties

Use the following method to get the PrintJob instance to control the print operation: Toolkit.GetPrintJob (Frame F, String Jobtitle, Properties Pro) So the settings for printing properties can be implemented by setting the Prop properties, printing properties include: AWT.PRINT .destination: Can be "printer" or "file" aff.print.printer: Printer Name AWT.PRINT.FILENAME: Print file name AWT.PRINT.NUMCOPIES: print account AWT.PRINT.Options: Print command print option AWT .print.orientation: Printing direction, can be "portrait" or "landscape" aff.print.papersize: Paper size, can be "letter", "legal", "executive" or "a4"

转载请注明原文地址:https://www.9cbs.com/read-21434.html

New Post(0)