邪恶漫画之佐良哪:使用java.print类别打印字符串,为何不行,请进来!!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/11 01:14:26
<%
//String content = taContent.getText();

String content="asdf";
try {

PrintService service =PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = service.createPrintJob();
DocFlavor flavor = DocFlavor.STRING.TEXT_PLAIN;
PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor,null);
for(int i=0;i<services.length;i++)
{
out.println(services[i].getName()+"<br>");
}
Doc doc = new SimpleDoc(content, flavor, null);
job.print(doc,null);
} catch(PrintException e) {
out.println(e);
}

%>
报错:sun.print.PrintJobFlavorException: invalid flavor

请问如何解决?急!!!