印刷ジョブを特定のプリンターに送信するために、次のコードを使用しています。
PrintServiceAttributeSet aset = new HashPrintServiceAttributeSet();
try {
aset.add(new PrinterURI(new URI("ipp://hostName/printerName")));
} catch (URISyntaxException e) {
System.out.println("URI exception caught: "+e);
}
PrintService[] services =
PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.POSTSCRIPT,aset);
Strangley、9つのルックアップ結果(=その特定のホストで使用可能なすべてのプリンター)を取得しますが、最初の結果のみが私が探しているものです。PrintService JavaDocsとWebで検索しましたが、問題については何も見つかりませんでした。
PrintServiceLookupは、私の要求に一致するプリンターのみを返すことを期待されていませんか?(この場合-1台のプリンター)
前もって感謝します!