Line Count

Line Count

Forum member · Jan 25, 2006
I'm using Dynamic PDF with a SQL Database behind it, however I'm having problems with spacing, so I'm wondering if there is a line count Function. Anyone?

Re: Line Count

Support · Jan 25, 2006
There is no way to determine the exact number of lines contained within a TextArea (is this the object that you are using to output the data to the PDF?). But the TextArea does have a GetRequiredHeight method that will return the height that it will take to output the entire text within that TextArea. Using this value you can calculate, depending on the padding needed, the location to place your next TextArea on the page. If you were referring to the spacing between each line within a TextArea, you can use the Leading property of TextArea to control this space. Thanks, ceTe Software Support Team

Re: Line Count

Forum member · Jan 25, 2006
Is it possible for you to give me an example of how to use that? It would be greatly appreciated.

Re: Line Count

Support · Jan 25, 2006
Here is a quick example of how to use the GetRequiredHeight. This example creates a TextArea and then places a line directly after the text is complete. This would work regardless of the amount of text supplied. Document document = new Document(); Page page = new Page(); document.Pages.Add( page ); string text = "This is some variable length text that i will use test."; TextArea ta = new TextArea( text, 75, 50, 100, 400, Font.Helvetica, 16 ); float nextYValue = 50 + ta.GetRequiredHeight(); Line line = new Line( 75, nextYValue, 175, nextYValue ); page.Elements.Add( ta ); page.Elements.Add( line ); document.DrawToWeb( this ); Thanks, ceTe Software Support Team

Re: Line Count

Forum member · Jan 25, 2006
Great! Exactly what I was looking for. Thanks for the help.