Mac OS X 10.8.0 で以下の Java コードを含む JPEG ファイルを印刷しようとすると、次のエラー メッセージが表示されます。
Error: pstopdffilter/pstocupsraster failed with err number 31000
Google で検索すると、問題が Java に直接関係していないことを示唆するような提案が表示されます (例: http://forum.parallels.com/showthread.php?t=106337 )。
/**
* http://stackoverflow.com/questions/7843338/printing-a-tif-file
*
* @param graphicFile
* @throws PrintException
* @throws IOException
*/
public void printGraphic(File graphicFile) throws PrintException,
IOException {
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
pras.add(Chromaticity.COLOR);
pras.add(MediaSizeName.ISO_A4);
PrintService pss[] = PrintServiceLookup.lookupPrintServices(
DocFlavor.INPUT_STREAM.JPEG, pras);
if (pss.length == 0)
throw new RuntimeException("No printer services available.");
PrintService ps = pss[0];
System.out.println("Printing to " + ps);
DocPrintJob job = ps.createPrintJob();
FileInputStream fin = new FileInputStream(graphicFile);
Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.JPEG, null);
job.print(doc, pras);
fin.close();
}