code: public void calculateSize(PdfContext context) {
  		float width = 0;
  		float height = 0;
  		for (PrintComponent<?> child : children) {
  			child.calculateSize(context);
  			float cw = child.getBounds().getWidth() + 2 * child.getConstraint().getMarginX();
  			float ch = child.getBounds().getHeight() + 2 * child.getConstraint().getMarginY();
  			switch (getConstraint().getFlowDirection()) {
  				case LayoutConstraint.FLOW_NONE:
  					width = Math.max(width, cw);
  					height = Math.max(height, ch);
  					break;
  				case LayoutConstraint.FLOW_X:
  					width += cw;
  					height = Math.max(height, ch);
  					break;
  				case LayoutConstraint.FLOW_Y:
  					width = Math.max(width, cw);
  					height += ch;
  					break;
  				default:
  					throw new IllegalStateException("Unknown flow direction " + getConstraint().getFlowDirection());
  			}
  		}
  		if (getConstraint().getWidth() != 0) {
  			width = getConstraint().getWidth();
  		}
  		if (getConstraint().getHeight() != 0) {
  			height = getConstraint().getHeight();
  		}
  		setBounds(new Rectangle(0, 0, width, height));
  	}
docs: Calculates the size based constraint width and height if present, otherwise from children sizes.