public static List <iText.Layout.Element.IElement> ToIText(this CanvasControl control) { List <iText.Layout.Element.IElement> list = new List <iText.Layout.Element.IElement>(); if (control is CanvasRichTextBox rtb) { list.Add(rtb.ToIText()); } else if (control is CanvasImage image) { list.Add(image.ToIText()); } else if (control.GetType().IsSubclassOf(typeof(CanvasVariable))) { CanvasVariable cv = control as CanvasVariable; list.Add(cv.ToIText()); } else { Logger.Log(Severity.ERROR, LogCategory.CONTROL, "Conversion from " + control.GetType().ToString() + " to iText element array not implemented."); } return(list); }