我使用Applet实现打印,在使用Java SDK1.4的时候正常,但装了1.5之后,发现打印时,文字方向成纵向的了,错误图见下边的链接:
http://blog.csdn.net/images/blog_csdn_net/jjcwww/19056/t_print.JPG我的程序打印部分的代码如下: //打印按钮
public void actionPerformed(ActionEvent e) { PrinterJob printJob = PrinterJob.getPrinterJob();
if (pageFormat == null)
pageFormat = printJob.defaultPage();
Paper p=new Paper();
p.setSize(539,261);
p.setImageableArea(0,0,539,261);
pageFormat.setPaper(p);
printJob.setPrintable(printPanel, pageFormat);
if (printJob.printDialog())
{
try
{
printJob.print();
}
catch (PrinterException exception)
{
System.out.println(exception);
}
}
}
http://blog.csdn.net/images/blog_csdn_net/jjcwww/19056/t_print.JPG我的程序打印部分的代码如下: //打印按钮
public void actionPerformed(ActionEvent e) { PrinterJob printJob = PrinterJob.getPrinterJob();
if (pageFormat == null)
pageFormat = printJob.defaultPage();
Paper p=new Paper();
p.setSize(539,261);
p.setImageableArea(0,0,539,261);
pageFormat.setPaper(p);
printJob.setPrintable(printPanel, pageFormat);
if (printJob.printDialog())
{
try
{
printJob.print();
}
catch (PrinterException exception)
{
System.out.println(exception);
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货