我说使用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();
}
}
}
请帮助我