java实现发票打印代码

上传者: halo_java | 上传时间: 2021-08-04 22:27:06 | 文件大小: 78KB | 文件类型: RAR
package com.lenovo.union.printreceipt.test; import java.awt.*; import java.awt.print.*; public class Test implements Printable { private static Font fnt = new Font("Helvetica", Font.PLAIN, 24); public static void main(String[] args) { // Get a PrinterJob PrinterJob job = PrinterJob.getPrinterJob(); // Specify the Printable is an instance of SimplePrint job.setPrintable(new Test()); // Put up the dialog box if (job.printDialog()) { // Print the job if the user didn't cancel printing try { job.print(); } catch (Exception e) { /* handle exception */} } System.exit(0); } public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException { // pageIndex 0 to 4 corresponds to page numbers 1 to 5. if (pageIndex >= 1) { return Printable.NO_SUCH_PAGE; } g.setFont(fnt); g.setColor(Color.green); g.drawString("Page " + (pageIndex + 1), 100, 100); g.drawRect(200, 200, 400, 300); return Printable.PAGE_EXISTS; } }

文件下载

资源详情

[{"title":"( 71 个子文件 78KB ) java实现发票打印代码","children":[{"title":"com","children":[{"title":"lenovo","children":[{"title":"union","children":[{"title":"printreceipt","children":[{"title":"ConditionInputUI$OkImplementor.class <span style='color:#111;'> 1.11KB </span>","children":null,"spread":false},{"title":"NextPreviousUtil.class <span style='color:#111;'> 9.34KB </span>","children":null,"spread":false},{"title":"Frame1.jbx <span style='color:#111;'> 139B </span>","children":null,"spread":false},{"title":"PrinterUtil2.class <span style='color:#111;'> 3.03KB </span>","children":null,"spread":false},{"title":"TableDemo.class <span style='color:#111;'> 1.68KB </span>","children":null,"spread":false},{"title":"ReceiptItem.jbx <span style='color:#111;'> 478B </span>","children":null,"spread":false},{"title":"BatchPrintUtil.java.bak <span style='color:#111;'> 3.10KB </span>","children":null,"spread":false},{"title":"TableDemo$1.class <span style='color:#111;'> 404B </span>","children":null,"spread":false},{"title":"StillJPanel.java <span style='color:#111;'> 914B </span>","children":null,"spread":false},{"title":"ConditionInputUI.java <span style='color:#111;'> 5.45KB </span>","children":null,"spread":false},{"title":"MappingUtil.class <span style='color:#111;'> 937B </span>","children":null,"spread":false},{"title":"db","children":[{"title":"ConnectionManager.java <span style='color:#111;'> 2.04KB </span>","children":null,"spread":false},{"title":"ConnectionManager.class <span style='color:#111;'> 1.73KB </span>","children":null,"spread":false}],"spread":false},{"title":"DatabaseUtil.java <span style='color:#111;'> 6.68KB </span>","children":null,"spread":false},{"title":"CoordinateLoader.class <span style='color:#111;'> 1.42KB </span>","children":null,"spread":false},{"title":"SinglePrintUtil.class <span style='color:#111;'> 3.57KB </span>","children":null,"spread":false},{"title":"DraggableJPanel$1.class <span style='color:#111;'> 854B </span>","children":null,"spread":false},{"title":"Receipt.jbx~ <span style='color:#111;'> 1.20KB </span>","children":null,"spread":false},{"title":"DatabaseUtil.class <span style='color:#111;'> 5.60KB </span>","children":null,"spread":false},{"title":"UIEntriesUtil.class <span style='color:#111;'> 8.19KB </span>","children":null,"spread":false},{"title":"SaveUtil.java <span style='color:#111;'> 1.28KB </span>","children":null,"spread":false},{"title":"Test.jbx <span style='color:#111;'> 37B </span>","children":null,"spread":false},{"title":"DraggableJPanel.java <span style='color:#111;'> 1.36KB </span>","children":null,"spread":false},{"title":"MappingUtil.java <span style='color:#111;'> 1.31KB </span>","children":null,"spread":false},{"title":"AlertUI.class <span style='color:#111;'> 2.06KB </span>","children":null,"spread":false},{"title":"SwingReceiptPrintUI.java <span style='color:#111;'> 6.51KB </span>","children":null,"spread":false},{"title":"CurrentListHolder.java <span style='color:#111;'> 133B </span>","children":null,"spread":false},{"title":"ConfigParams.java <span style='color:#111;'> 2.86KB </span>","children":null,"spread":false},{"title":"TableDemo$MyTableModel.class <span style='color:#111;'> 2.84KB </span>","children":null,"spread":false},{"title":"dbconfig.cfg <span style='color:#111;'> 614B </span>","children":null,"spread":false},{"title":"TableDemo.jbx <span style='color:#111;'> 84B </span>","children":null,"spread":false},{"title":"PrinterUtil.class <span style='color:#111;'> 2.23KB </span>","children":null,"spread":false},{"title":"DraggableJPanel.class <span style='color:#111;'> 2.05KB </span>","children":null,"spread":false},{"title":"Receipt.java <span style='color:#111;'> 6.90KB </span>","children":null,"spread":false},{"title":"SystemProperties.class <span style='color:#111;'> 1.93KB </span>","children":null,"spread":false},{"title":"SaveUtil.class <span style='color:#111;'> 1.87KB </span>","children":null,"spread":false},{"title":"SwingReceiptPrintUI.class <span style='color:#111;'> 6.04KB </span>","children":null,"spread":false},{"title":"SQLStringMaker.class <span style='color:#111;'> 1.96KB </span>","children":null,"spread":false},{"title":"SwingReceiptPrintUI$2.class <span style='color:#111;'> 606B </span>","children":null,"spread":false},{"title":"Receipt.jbx <span style='color:#111;'> 1.35KB </span>","children":null,"spread":false},{"title":"test","children":[{"title":"Test.java <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false}],"spread":false},{"title":"Frame1.class <span style='color:#111;'> 1.04KB </span>","children":null,"spread":false},{"title":"PrintTest.class <span style='color:#111;'> 5.23KB </span>","children":null,"spread":false},{"title":"coordinates.cfg <span style='color:#111;'> 1.09KB </span>","children":null,"spread":false},{"title":"Receipt.class <span style='color:#111;'> 5.85KB </span>","children":null,"spread":false},{"title":"PrintPreviewDialog$PreviewCanvas.class <span style='color:#111;'> 2.50KB </span>","children":null,"spread":false},{"title":"CoordinateLoader.java <span style='color:#111;'> 1.35KB </span>","children":null,"spread":false},{"title":"Constants.java <span style='color:#111;'> 2.38KB </span>","children":null,"spread":false},{"title":"NextPreviousUtil.java <span style='color:#111;'> 20.09KB </span>","children":null,"spread":false},{"title":"CurrentListHolder.class <span style='color:#111;'> 303B </span>","children":null,"spread":false},{"title":"AlertUI.java <span style='color:#111;'> 2.12KB </span>","children":null,"spread":false},{"title":"coordinates.cfg.bak <span style='color:#111;'> 1.10KB </span>","children":null,"spread":false},{"title":"SQLStringMaker.java <span style='color:#111;'> 2.38KB </span>","children":null,"spread":false},{"title":"ConfigParams.class <span style='color:#111;'> 2.82KB </span>","children":null,"spread":false},{"title":"ConditionInputUI$2.class <span style='color:#111;'> 579B </span>","children":null,"spread":false},{"title":"UIEntriesUtil.java <span style='color:#111;'> 13.48KB </span>","children":null,"spread":false},{"title":"ConditionInputUI.class <span style='color:#111;'> 4.93KB </span>","children":null,"spread":false},{"title":"UIEntriesUtil.jbx <span style='color:#111;'> 187B </span>","children":null,"spread":false},{"title":"ReceiptItem.java <span style='color:#111;'> 1.57KB </span>","children":null,"spread":false},{"title":"DatabaseUtil.jbx <span style='color:#111;'> 88B </span>","children":null,"spread":false},{"title":"BatchPrintUtil.java <span style='color:#111;'> 4.75KB </span>","children":null,"spread":false},{"title":"SwingReceiptPrintUI$1.class <span style='color:#111;'> 591B </span>","children":null,"spread":false},{"title":"DatabaseUtil.jbx~ <span style='color:#111;'> 88B </span>","children":null,"spread":false},{"title":"PrintPreviewDialog.class <span style='color:#111;'> 2.23KB </span>","children":null,"spread":false},{"title":"Constants.class <span style='color:#111;'> 2.67KB </span>","children":null,"spread":false},{"title":"BatchPrintUtil.class <span style='color:#111;'> 4.70KB </span>","children":null,"spread":false},{"title":"SinglePrintUtil.java <span style='color:#111;'> 3.01KB </span>","children":null,"spread":false},{"title":"AlertUI$1.class <span style='color:#111;'> 543B </span>","children":null,"spread":false},{"title":"ConditionInputUI$1.class <span style='color:#111;'> 579B </span>","children":null,"spread":false},{"title":"StillJPanel.class <span style='color:#111;'> 1.15KB </span>","children":null,"spread":false},{"title":"ReceiptItem.class <span style='color:#111;'> 1.55KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明