JavaFX PrinterJob WebView

时间:2016-10-26 17:47:11

标签: java javafx

我正在尝试打印" www.google.com"但, 打印不包括背景图像,它只打印文本,我如何包含它?

守则,

public void print() {
        logger.info("Print Event  -  Message:  " + "Iniciando Impressora");
        ChoiceDialog dialog = new ChoiceDialog(Printer.getDefaultPrinter(), Printer.getAllPrinters());
        dialog.setTitle("Escolha uma Impressora!");
        dialog.setHeaderText("Confirme a escolha de uma impressora!");
        Optional<Printer> opt = dialog.showAndWait();
        if (opt.isPresent()) {
            Printer p = opt.get();
            PageLayout pageLayout = p.createPageLayout(Paper.A4, PageOrientation.PORTRAIT, Printer.MarginType.DEFAULT);
            PrinterJob job = PrinterJob.createPrinterJob(p);
            webEngine.print(job);
            job.endJob();
        }
    }

我也需要打印背景图像。 提前谢谢。

0 个答案:

没有答案