g2d.setColor(Color.RED);
g2d.setFont(new Font("sans-serif", Font.PLAIN, 36));
g2d.drawString("Hello world!", 140, 140);
g2d.setColor(Color.RED.darker());
g2d.setFont(new Font("serif", Font.PLAIN, 36));
g2d.drawString("Hello world!", 140, 180);
g2d.nextPage(); //Move to next page
g2d.setFont(new Font("sans-serif", Font.PLAIN, 36));
g2d.drawString("Welcome to page 2!", 140, 140);