【发布时间】:2015-11-02 07:58:19
【问题描述】:
所以,我的问题是我需要打印我的 tableview 的内容,但我有这么多的项目,它只打印其中的前 23 个。 我已经在这里找到了一些解决方案,不幸的是它们并没有太大帮助。
这是我的打印方法:
@FXML
private void printIt() {
Printer printer = Printer.getDefaultPrinter();
PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);
double scaleX = pageLayout.getPrintableWidth() / logBookTable.getBoundsInParent().getWidth();
double scaleY = pageLayout.getPrintableHeight() / logBookTable.getBoundsInParent().getHeight();
logBookTable.getTransforms().add(new Scale(scaleX, scaleY));
PrinterJob job = PrinterJob.createPrinterJob();
if (job != null) {
boolean successPrintDialog = job.showPrintDialog(dialogStage);
if(successPrintDialog){
boolean success = job.printPage(pageLayout,logBookTable);
if (success) {
job.endJob();
}
}
}
}
【问题讨论】:
标签: java printing javafx tableview