public int print(Graphics pg, PageFormat pf, int pi)
throws PrinterException
{
- pg.setFont(font);
- pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
int pwidth = (int) pf.getImageableWidth();
int pheight = (int) pf.getImageableHeight();
pwidth = getWidth();
}
+ pg = pg.create();
+ pg.setFont(font);
+ pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
+
if (fitToWindow)
{
if (pheight > getHeight())
FontMetrics fm = pg.getFontMetrics(font);
int height = fm.getHeight() * nameHash.size();
pg.translate(0, -pi * pheight);
- pg.setClip(0, pi * pheight, pwidth, (pi * pheight) + pheight);
+ // BH 2020.03.19 avoiding setClip here
+ pg.clipRect(0, pi * pheight, pwidth, (pi * pheight) + pheight);
// translate number of pages,
// height is screen size as this is the
draw(pg, pwidth, pheight);
+ pg.dispose();
+
return Printable.PAGE_EXISTS;
}