使用javafx打印条形码

时间:2019-04-21 06:08:43

标签: printing javafx-8 barcode

我说使用javafx打印条形码,但是效果不好

我尝试使用打印机打印的服装纸尺寸为5 * 2.5 CM的条形码

public void print(ImageView node) {
        Printer printer = Printer.getDefaultPrinter();
        Paper label = PrintHelper.createPaper("38x30", 50, 25, Units.MM);
        printer.getPrinterAttributes().getSupportedPapers();


        PageLayout pageLayout = printer.createPageLayout(label, PageOrientation.PORTRAIT,0f,0f,0f,0f);

        PrinterJob job = PrinterJob.createPrinterJob();

        if (job != null  && job.showPrintDialog(node.getScene().getWindow()) ) {
            boolean success = job.printPage(node);
            if (success) {
                job.endJob();
            }
        }


    }

this is the result

请帮助我

0 个答案:

没有答案