| |
17. 110. 2. Get the entire printable area of the page for the selected printer |
|
import org.eclipse.swt.printing.PrintDialog;
import org.eclipse.swt.printing.Printer;
import org.eclipse.swt.printing.PrinterData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MainClass {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
PrintDialog dlg = new PrintDialog(shell);
dlg.setScope(PrinterData.SELECTION);
PrinterData printerData = dlg.open();
if (printerData != null) {
Printer printer = new Printer(printerData);
System.out.println(printer.getClientArea());
printer.dispose();
}
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
|
|
17. 110. 打印 | | 17. 110. 1. | 打印 | | | | 17. 110. 2. | Get the entire printable area of the page for the selected printer | | | | 17. 110. 3. | 1英寸边界 | | | | 17. 110. 4. | 打印文本 | | | | 17. 110. 5. | 打印图形 | | | | 17. 110. 6. | 打印DPI | | | | 17. 110. 7. | 打印出字符串 | | | | 17. 110. 8. | 打印文本,自动换行和分页 | | |
|