When trying to print a JPEG file with the Java code below on Mac OS X 10.8.0 I get
the error message:
Error: pstopdffilter/pstocupsraster failed with err number 31000
A Gooogle search brings suggestions that seem to hint that the problem is not directly to Java
e.g.
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();
}
As a workaround I would suggest to use jpeg instead of tiff.