我正在尝试使用DocFlavor打印瑞典字符,但我无法做到。
我的打印机仅支持Flavors。
Win32 Printer : V2PRINTER supports :
image/gif; class="[B"
image/gif; class="java.io.InputStream"
image/gif; class="java.net.URL"
image/jpeg; class="[B"
image/jpeg; class="java.io.InputStream"
image/jpeg; class="java.net.URL"
image/png; class="[B"
image/png; class="java.io.InputStream"
image/png; class="java.net.URL"
application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
application/octet-stream; class="[B"
application/octet-stream; class="java.net.URL"
application/octet-stream; class="java.io.InputStream"
以下是代码段
psStream = new FileInputStream("C:\temp.txt");
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc myDoc = new SimpleDoc(psStream, psInFormat, null);
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
try
{
DocPrintJob job = printer.createPrintJob();
job.print(myDoc, aset);
psStream.close();
}
如果有人遇到同样的问题并且有解决方案,请告诉我。由于打印机性能问题,我不想使用Graphics2d类。
先谢谢。 拉维