打印指定页号的具体文本内容*/
private void drawCurrentPageText(Graphics2D g2, PageFormat pf, int page) {
String s = getDrawText(printStr)[page]; //获取当前页的待打印文本内容
//获取默认字体及相应的尺寸
FontRenderContext context = g2.getFontRenderContext();
Font f = area.getFont();
String drawText;
float ascent = 16; //给定字符点阵
int k, i = f.getSize(), lines = 0;
while(s.length() > 0 && lines < 54) //每页限定在54行以内
{
温馨提示:答案为网友推荐,仅供参考