本文整理匯總了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.");
}
}