public PrintReport(JTable table, String title,String sumPrice,int cno) {
this.table = (GeneralTableModel) table.getModel();
this.title = title;
this.sumPrice = sumPrice;
this.cno = Integer.toString(cno);
titleFont = new Font(title, Font.ROMAN_BASELINE, 20); try {
PrintService[] services = PrintServiceLookup.lookupPrintServices(
DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (services.length > 0) {
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
PrintService service = ServiceUI.printDialog(null, 200, 200,
services, services[0], null, attributes);
if (service != null) {
DocPrintJob job = service.createPrintJob();
Doc doc = new SimpleDoc(this,DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attributes);
}
}
} catch (PrintException pe) {
pe.printStackTrace();
}
Function.addNum();
}
我想在上面的程序里,设置打印纸的大小为250mm*160mm,请高手帮帮忙!
谢谢!
this.table = (GeneralTableModel) table.getModel();
this.title = title;
this.sumPrice = sumPrice;
this.cno = Integer.toString(cno);
titleFont = new Font(title, Font.ROMAN_BASELINE, 20); try {
PrintService[] services = PrintServiceLookup.lookupPrintServices(
DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (services.length > 0) {
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
PrintService service = ServiceUI.printDialog(null, 200, 200,
services, services[0], null, attributes);
if (service != null) {
DocPrintJob job = service.createPrintJob();
Doc doc = new SimpleDoc(this,DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
job.print(doc, attributes);
}
}
} catch (PrintException pe) {
pe.printStackTrace();
}
Function.addNum();
}
我想在上面的程序里,设置打印纸的大小为250mm*160mm,请高手帮帮忙!
谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货