本文整理汇总了Java中javax.print.PrintService.isAttributeValueSupported方法的典型用法代码示例。如果您正苦于以下问题:Java PrintService.isAttributeValueSupported方法的具体用法?Java PrintService.isAttributeValueSupported怎么用?Java PrintService.isAttributeValueSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.PrintService
的用法示例。
在下文中一共展示了PrintService.isAttributeValueSupported方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSupportedValue
import javax.print.PrintService; //导入方法依赖的package包/类
protected boolean isSupportedValue(Attribute attrval,
PrintRequestAttributeSet attrset) {
PrintService ps = getPrintService();
return
(attrval != null && ps != null &&
ps.isAttributeValueSupported(attrval,
DocFlavor.SERVICE_FORMATTED.PAGEABLE,
attrset));
}
示例2: doPrinterJob
import javax.print.PrintService; //导入方法依赖的package包/类
public static void doPrinterJob(String fileStr, OrientationRequested o) {
PrinterJob pj = PrinterJob.getPrinterJob();
PrintService ps = pj.getPrintService();
if (ps == null) {
System.out.println("No print service found.");
return;
}
pj.setPrintable(new PrintToDir());
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(o);
File f = new File(fileStr);
// f.deleteOnExit();
URI dest = f.toURI();
Destination d = new Destination(dest);
if (ps.isAttributeValueSupported(d, null, null)) {
aset.add(d);
try {
pj.print(aset);
} catch (PrinterException e) {
System.out.println("PrinterJob passed.");
return;
}
throw new RuntimeException("PrinterJob:PrinterException expected but not thrown. \nTEST FAILED");
} else {
System.out.println("Destination attribute is not a supported value. PrinterJob passed.");
}
}