}
document.add(par);
// Create a new rectangle RtfShape. By default it will be above the text
RtfShapePosition position = new RtfShapePosition(1000, 1000, 2000, 2000);
RtfShape shape = new RtfShape(RtfShape.SHAPE_RECTANGLE, position);
document.add(shape);
// Create a rounded rectangle RtfShape and position it below the text
position = new RtfShapePosition(4000, 1500, 4500, 5000);
position.setShapeBelowText(true);
shape = new RtfShape(RtfShape.SHAPE_ROUND_RECTANGLE, position);
shape.setProperty(
new RtfShapeProperty(RtfShapeProperty.PROPERTY_ADJUST_VALUE, 4500));
shape.setProperty(
new RtfShapeProperty(RtfShapeProperty.PROPERTY_FILL_COLOR, Color.GRAY));
document.add(shape);
// Create a triangle RtfShape, around which text will wrap on both sides
position = new RtfShapePosition(1500, 3000, 4000, 2500);
shape = new RtfShape(RtfShape.SHAPE_TRIANGLE_RIGHT, position);
shape.setWrapping(RtfShape.SHAPE_WRAP_BOTH);
document.add(shape);
// Create an elliptical RtfShape, around which text will only wrap on the left side
position = new RtfShapePosition(3000, 6000, 10500, 4500);
shape = new RtfShape(RtfShape.SHAPE_ELLIPSE, position);
shape.setWrapping(RtfShape.SHAPE_WRAP_LEFT);
shape.setProperty(
new RtfShapeProperty(RtfShapeProperty.PROPERTY_FILL_COLOR, Color.BLUE));
document.add(shape);
// Create a circular RtfShape and set its z-order to 1
position = new RtfShapePosition(5850, 6800, 8200, 7250);
position.setZOrder(1);
shape = new RtfShape(RtfShape.SHAPE_ELLIPSE, position);
shape.setProperty(new RtfShapeProperty(RtfShapeProperty.PROPERTY_FILL_COLOR, Color.RED));
document.add(shape);
// Create a star RtfShape and set its z-order to 2, above the circle
// defined above
position = new RtfShapePosition(6000, 7000, 8000, 7000);
position.setZOrder(2);
shape = new RtfShape(RtfShape.SHAPE_STAR, position);
shape.setProperty(new RtfShapeProperty(RtfShapeProperty.PROPERTY_FILL_COLOR, Color.YELLOW));
document.add(shape);
document.close();
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();