本文整理汇总了Java中com.openbravo.pos.util.SelectPrinter类的典型用法代码示例。如果您正苦于以下问题:Java SelectPrinter类的具体用法?Java SelectPrinter怎么用?Java SelectPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectPrinter类属于com.openbravo.pos.util包,在下文中一共展示了SelectPrinter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: endReceipt
import com.openbravo.pos.util.SelectPrinter; //导入依赖的package包/类
/**
* Method that is responsible for ending and printing a ticket<br>
* It manages to get a printerJob, set the name of the job, get a Book object<br>
* and print the receipt
*/
@Override
public void endReceipt() {
try {
PrintService ps;
if (printservice == null) {
String[] printers = ReportUtils.getPrintNames();
if (printers.length == 0) {
logger.warning(AppLocal.getIntString("message.noprinters"));
ps = null;
} else {
SelectPrinter selectprinter = SelectPrinter.getSelectPrinter(parent, printers);
selectprinter.setVisible(true);
if (selectprinter.isOK()) {
ps = ReportUtils.getPrintService(selectprinter.getPrintService());
} else {
ps = null;
}
}
} else {
ps = printservice;
}
if (ps != null) {
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(OrientationRequested.PORTRAIT);
aset.add(new JobName(AppLocal.APP_NAME + " - Document", null));
aset.add(media);
DocPrintJob printjob = ps.createPrintJob();
Doc doc = new SimpleDoc(new PrintableBasicTicket(m_ticketcurrent, imageable_x, imageable_y, imageable_width, imageable_height), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
printjob.print(doc, aset);
}
} catch (PrintException ex) {
logger.log(Level.WARNING, AppLocal.getIntString("message.printererror"), ex);
JMessageDialog.showMessage(parent, new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.printererror"), ex));
}
//ticket is not needed any more
m_ticketcurrent = null;
}
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:52,代码来源:DevicePrinterPrinter.java
注:本文中的com.openbravo.pos.util.SelectPrinter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论