void DrawGroup(PdfContentByte cb) { //TODO if width and height not know: what to do //PdfTemplate template = cb.CreateTemplate(this.width, this.height); PdfTemplate template = cb.CreateTemplate(500, 500); //draw the list of elements on the new template IList <int> xSpacing = null, ySpacing = null; float defaultSpacing = template.CharacterSpacing; float rise = 0; template.BeginText(); // foreach (IElement elem in this.list) { Text text = (Text)elem; //CssSvgAppliers.GetInstance().ApplyForText(, text.GetCss(), text.GetChunk()); CssSvgAppliers.GetInstance().ApplyForText(template, text.GetCss(), text.GetChunk()); if (!text.IsRelative()) { //when there are x,y coordinates in the text or tspan template.SetTextMatrix(text.GetX(), -1 * text.GetY()); } //System.out.Println(text.chunk.GetFont()); //the spacing if (text.Dx != null) { xSpacing = text.Dx; } if (text.Dy != null) { ySpacing = text.Dy; rise = 0; } if (xSpacing != null || ySpacing != null) { String display = text.GetText(); for (int i = 0; i < display.Length; i++) { if (xSpacing != null && xSpacing.Count > 0) { template.SetCharacterSpacing(xSpacing[0]); xSpacing.Remove(0); } if (ySpacing != null && ySpacing.Count > 0) { rise = rise - ySpacing[0]; template.SetTextRise(rise); ySpacing.Remove(0); } else { template.SetTextRise(rise); } template.ShowText(display.Substring(i, 1)); template.SetCharacterSpacing(defaultSpacing); } } else { template.ShowText(text.GetText()); } } template.EndText(); //add the template at the x, y position cb.ConcatCTM(1, 0, 0, -1, 0, 0); cb.Add(template); }