Posted by a ceTe Software moderator
Hello,
You can achieve this by setting the rectangles x, y width and height based on the same values used for the TextArea then using the align and vAlign properties of the TextArea. Here is a code sample:
MergeDocument doc = new MergeDocument(@"Input PDF file path");
Rectangle rectangle = new Rectangle(105, 105, 60, 50);
rectangle.BorderStyle = LineStyle.Solid;
rectangle.CornerRadius = 5;
rectangle.FillColor = RgbColor.Yellow;
rectangle.ID = "Exhibit 1 Rectangle";
TextArea textArea = new TextArea("Exhibits 1", 105, 105, 60, 50);
textArea.ID = "Exhibit 1 Text";
textArea.Align = TextAlign.Center;
textArea.VAlign = VAlign.Center;
doc.Pages[0].Elements.Add(rectangle);
doc.Pages[0].Elements.Add(textArea);
doc.Draw(@"Output PDF file path");
Thanks,
ceTe Software Support Team