翻看API发现Itext里面未有设置粗细的属性,另辟蹊径,画矩形填充,代码如下:
RtfShapePosition position = new RtfShapePosition(150, 0, 10400, 200);
position.setXRelativePos(RtfShapePosition.POSITION_X_RELATIVE_MARGIN);
position.setYRelativePos(RtfShapePosition.POSITION_Y_RELATIVE_PARAGRAPH);
RtfShape shape = new RtfShape(RtfShape.SHAPE_RECTANGLE, position);
RtfShapeProperty property = new RtfShapeProperty(RtfShapeProperty.PROPERTY_FILL_COLOR,Color.black);
shape.setProperty(property);