PdfGraphics2D graphics2D = (PdfGraphics2D) cb.createGraphicsShapes(500, 700);
graphics2D.drawString("Hello World", 100, 400);
graphics2D.drawLine(500, 300, 200, 200);
graphics2D.setBackground(Color.black);
graphics2D.fillRect(50,50, 300,300);
graphics2D.dispose();
Graphics2D graphics2D = cb.createGraphicsShapes(500, 700);
graphics2D.drawString("Hello World", 100, 400);
graphics2D.drawLine(500, 300, 200, 200);
graphics2D.setBackground(Color.black);
graphics2D.fillRect(50,50, 300,300);
graphics2D.dispose();