The instant someone edits the field the alignment will be something else. If you still insist look at the TextField class code to see how the lines are calculated.
Paulo ----- Original Message ----- From: "Marcin Owsiany" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, October 10, 2006 4:53 PM Subject: [iText-questions] How to count lines in a multiline form text field? > Hi, > > Short version: > -------------- > > Let's say I have: > - an externally-provided PDF file, which contains a multiline form field, > - a text string which is to be inserted into it, > - a certain font and text size > I do not have the dimensions of the field, unless it's possible to > retrieve them from the document. > > I'd like to be able to find out how many lines the text would take in > the field, before I output the modified document. > > Is it possible? Could you point me in the general direction of classes > and methods I should look at? > > Longer version: > --------------- > > The reason I want this (in case that way is not possible, but there is a > different way to do this) is to vertically align contents of several > multiline form fields, like this: > > | +------------++---------------------+ +----------------+ > | | || | | | > | | Some stuff || This is very short. | | And this part | > | | in here, || | | can be some- | > | | which is || | | what in between| > | | quite long || | | in terms of | > | | compared || | | length. | > | | to the || | | | > | | other form || | | | > | | fields. || | | | > | | || | | | > | | The next || But we want this bit| | But still this | > | | bit of in- || to be aligned with | | must not start | > | | formation || the bit on the left | | higher than | > | | [...] || | | this. | > | +------------++---------------------+ +----------------+ > > I think that being able to calculate that the first bit in the first > form field would take 8 lines, in the second field - 1 line, and in > third - 5, I could add appropriate number of newlines to the first parts > of text in second and third fields, which would make the second parts > align nicely. > > And no, I cannot have two rows of form fields, because they are embedded > in the document before I know whether there will be two or more sets of > information. > > kind regards, > > Marcin > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
