- priority: 5 --> 9
the translate(x,y) method of PDFGraphics class works
only with the Landscape orientation (not in PORTRAIT
orientation) and only with the drawString method. I've
tried with the drawline(x1,y1,x2,y2) after call the
translate and the line was at the same place.
The code:
Graphics pjg = pj.getGraphics();
pj.getCurrentPage().setOrientation
(PDFPage.LANDSCAPE);
((PDFGraphics)pjg).setOrientation();
Font f = new Font("Tahoma", Font.BOLD,
10);
pjg.setFont(f);
for (int i=10;i<=100;i+=10) {
((PDFGraphics)pjg).create();
((PDFGraphics)pjg).translate(10, 10);
((PDFGraphics)pjg).drawLine(20, 20, 100, 20);
((PDFGraphics)pjg).setColor(new Color(255-i,i,255-
i));
((PDFGraphics)pjg).drawString("A translated
string!",0,0);
}
pjg.dispose();
pj.end();