我强调的是要自己些代码,不要调用本地上的打印机,并且当我点击Button 打印按钮的时候不会弹出打印对话框,而是直接打印,我研究了很久,用了java中

public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
 Graphics2D g2 = (Graphics2D)g;
 g2.setPaint(Color.black); //设置打印颜色为黑色
 if (page >= PAGES) //当打印页号大于需要打印的总页数时,打印工作结束
  return Printable.NO_SUCH_PAGE;
 g2.translate(pf.getImageableX(), pf.getImageableY());//转换坐标,确定打印边界
 drawCurrentPageText(g2, pf, page); //打印当前页文本
 return Printable.PAGE_EXISTS; //存在打印页时,继续打印工作
}这个方法,但是一直想不通是怎么把jsp显示的内容传入打印机中,
我想问这段代码是干什么的: g2.drawString(str, (float) x, (float) y + 1 * heigth + img_Height); //第一排
 g2.drawString("oooooooooooo", (float) 50, (float) 60 + 1 * heigth + img_Height); //第二排
 g2.drawString("22222222222ddddddddddddddddddddddddddd222222222222", (float) 80, (float) 90 + 1 * heigth + img_Height); //第三排是不是用来录入自己想要打印的数据,本人比较愚拙,一直没有想出来,请给位大虾解决下我的联系方式是Email:[email protected]
              QQ:277985066

也可以到csdn中直接联系,谢谢了!