我正在嘗試在 JavaFX 應(yīng)用程序中打印表視圖。當(dāng)我將表格視圖直接傳遞到打印機(jī)Job.printPage(表格視圖)時,文本數(shù)據(jù)是其他語言,但視圖顯示得很好,即屏幕上的英語。...final TableView addItemTableView = (TableView) tabAnchorpane.getChildren().get(1);Printer printer = Printer.getDefaultPrinter();PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);double scaleX = pageLayout.getPrintableWidth() / addItemTableView.getBoundsInParent().getWidth();Scale scale = new Scale(scaleX, scaleX);addItemTableView.getTransforms().add(scale);PrinterJob printerJob = PrinterJob.createPrinterJob();if (printerJob.showPrintDialog(stage.getOwner()) && printerJob.printPage(pageLayout, addItemTableView)) { printerJob.endJob();}...表視圖由任務(wù)類中的數(shù)據(jù)填充public class Task implements Serializable { private static final long serialVersionUID = 2L; private transient StringProperty description; private transient IntegerProperty priority; private transient ObjectProperty<LocalDate> dueDate; private transient StringProperty status; private transient ObjectProperty<LocalDate> startDate; private transient ObjectProperty<LocalDate> endDate;...}實際打印頁面預(yù)期打印頁
在 JavaFX 中打印表格視圖顯示垃圾/其他語言字符
慕的地6264312
2022-09-22 19:41:57