Text Area

Text Area

Forum member · Nov 8, 2019
Hi, I am using the TextArea in a manner such as below: var headingText = new TextArea(HeadingText, marginX, marginY, page.Dimensions.Width - marginX, 10, HeadingTextFont, HeadingTextPoints, HeadingTextColor); In the parameter list, I have a “10” value hard coded in for the “float height” parameter. The problem is, I need the value to be dynamic based on the height that is produced by the text itself, not a predefined height. Because if the text is very short, it creates an unwanted gap. How can I do this ? Thanks Jim

Re: Text Area

Support · Nov 8, 2019
Hello, Yes, you can set the required height to the TextArea to fit the dynamic text without any problem using DynamicPDF Generator. You will need to get the required height to the fit the text using the GetRequiredHeight method and then set it for the TextArea’s height. TextArea headingText = new TextArea(HeadingText, marginX, marginY, page.Dimensions.Width - marginX, 10, HeadingTextFont, HeadingTextPoints, HeadingTextColor); //setting required height to fit the dynamic text. headingText.Height = headingText.GetRequiredHeight(); Thanks, ceTe Software Support Team