Option 2 is the easiest one. The generic tag gives the location of the text.
It's a simple matter of finding the number of points needed with
BaseFont.getWidthPoint() and place them in the space left with
PdfContentByte.showText().

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Bruno [SMTP:[EMAIL PROTECTED]
> Sent: Friday, June 27, 2003 15:07
> To:   Siew, Ivan
> Cc:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Re: iText: Generating dynamic dots between
> two phrases
> 
> Quoting "Siew, Ivan" <[EMAIL PROTECTED]>:
> 
> > I'm trying to generate this:
> > 
> > FirstName LastName.....................Phone Number
> > 
> > The dots will vary because people's FirstName and LastName will vary as
> they
> > are coming from a database. Is there a way to find out the spacing
> between
> > the two phrases and then generate the dots based on the available space?
> > 
> > I am placing FirstName LastName and the dots in one cell in a PdfPTable
> and
> > Phone Number in another cell.
> 
> There might be different ways to do this.
> 
> 1. Without a PdfPTable:
> construct a String with the complete line and measure it.
> Add points until a certain width is reached.
> 
> 2. With PageEvents:
> put the 'FirstName LastName' in one Chunk with a generic tag
> and 'Phone Number' in another. Let the Event-class keep the
> position of the first in memory and draw the points when the
> second generic tag is triggered.
> 
> 3. With a PdfPCellEvent:
> get the PdfPCell from the Event, ask for the content of
> the Phrase contained by the cell with getChunks and do
> some calculations... (rather difficult).
> 
> Maybe some people on the mailing list will send you
> other suggestions...
> 
> br,
> Bruno
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to