次のコードスニペットを使用して.GIF、.JPG、または.PNGを正常に印刷できますが、.TIFファイルでは機能しません。chromaticity.color
また、属性を追加しても色がわかりません。
public class PrintImage {
static public void main(String args[]) throws Exception {
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
pras.add(chromaticity.color);
PrintService pss[] = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.GIF, 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();
String fileName = "C:/labels/2.tif"
FileInputStream fin = new FileInputStream(fileName);
Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.GIF, null);
job.print(doc, pras);
fin.close();
}
印刷用に.TIFをサポートするにはどうすればよいですか?