code: @Override
     public void addToContainer(Element container, Element element) throws DocumentException, VectorPrintException {
        if (container instanceof TextElementArray) {
           if (element instanceof Image) {
              ((TextElementArray) container).add(new Chunk((Image) element, 0, 0, true));
           } else {
              ((TextElementArray) container).add(element);
           }
        } else if (container instanceof PdfPTable) {
           if (element instanceof PdfPCell) {
              ((PdfPTable) container).addCell((PdfPCell) element);
           } else if (element instanceof Phrase) {
              ((PdfPTable) container).addCell((Phrase) element);
           } else if (element instanceof PdfPTable) {
              ((PdfPTable) container).addCell((PdfPTable) element);
           } else if (element instanceof Image) {
              ((PdfPTable) container).addCell((Image) element);
           } else {
              throw new VectorPrintException(String.format("don't know how to add %s to %s", (element == null) ? "null" : element.getClass().getName(), (container == null) ? "null" : container.getClass().getName()));
           }
        } else if (container instanceof PdfPCell) {
           if (element instanceof PdfPTable) {
              throw new VectorPrintException(String.format("use %s.%s if you want to nest tables", CONTAINER_ELEMENT.class.getName(), CONTAINER_ELEMENT.NESTED_TABLE));
           }
           ((PdfPCell) container).addElement(element);
        } else if (container instanceof ColumnText) {
           ((ColumnText) container).addElement(element);
        } else {
           throw new VectorPrintException(String.format("don't know how to add %s to %s", (element == null) ? "null" : element.getClass().getName(), (container == null) ? "null" : container.getClass().getName()));
        }
     }
docs: attempts to add an element to a container
  
  @param container
  @param element
  @throws DocumentException