Yes i agree this is a very complicated feature.
Perhaps it will be more easy to start by text-only
table.
what i know is that : one can add data to PdfPTable
and just before adding the table to a Document or
ColumnText or another iText object, it is possible to
specify the widths of columns.
there is always something like "The better widths
Array" which has to be calculated according to the
width of text in each cell.
when adding a cell to PdfPtable, the cell should has a
parameter as "textWidthPoint". This is possible
beacause every char has a defined width in a given
font (getWidthPoint() in BaseFont). 
So, before plotting the table, the better width array
will be the max(textWidthPoint[]) for every column.
To prevent the table from getting very big or very
small, the user has to specify 2 arrays
"textWidthPointMax[]" and "textWidthPointMin[]"
as arguments in 
autoFitColumns(float[] textWidthPointMax, float[]
textWidthPointMin)

For images and other obejects, what matters is the
width of image, so textWidthPoints will better be
contnentWidthPoint.


Waiting for your comments.
BR,
Amine


 --- Paulo Soares <[EMAIL PROTECTED]> a �crit : 
> I have no plans to add that feature, there are too
> many variables and pdf is not html. You present a
> simplistic view of the problem but what if:
> 
> - text has a newline
> - text is very long or very short or no text at all
> - how many rows to examine
> - auto-sized images
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> >
> [mailto:[EMAIL PROTECTED]
> On 
> > Behalf Of amine ab.
> > Sent: Tuesday, January 18, 2005 4:57 PM
> > To: [email protected]
> > Subject: [iText-questions] PdfPtable : automatic
> fit columns with text
> > 
> > Hi,
> > I want to know if iText support columns automatic
> text
> > fitting in PdfPtable
> > 
> > look at the 3 examples below :
> > 
> > example 1 : cells are smaller than text
> > ----------------------------
> > | 1 st  cell  | 2 nd       |
> > | text        | cell text  |
> > ----------------------------
> > 
> > example 2 : cells are bigger than text
> >
>
-------------------------------------------------------
> > | 1 st  cell    text         | 2 nd cell text     
>   
> > |
> >
>
-------------------------------------------------------
> > 
> > example 3 : cells need only one line without over
> > space
> > --------------------------------------
> > | fisrst cell text | 2 nd  cell text |
> > --------------------------------------
> > 
> > suggestion : add a void PdfPtable.autoFitColumns()
> to
> > automate the calculation of the column width wich
> > prevent the text from skipping in 2 lengths but
> also
> > delete the over space.
> > 
> > does this feature exist?
> > if no, is it possible to add this in the next
> releases
> > ?
> > 
> > BR,
> > Amine
> > 
> > 
> > 
> >     
> > 
> >     
> >             
> > D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace
> de 
> > stockage pour vos mails ! 
> > Cr�ez votre Yahoo! Mail sur
> http://fr.mail.yahoo.com/
> > 
> > 
> >
>
-------------------------------------------------------
> > The SF.Net email is sponsored by: Beat the
> post-holiday blues
> > Get a FREE limited edition SourceForge.net t-shirt
> from ThinkGeek.
> > It's fun and FREE -- well,
> almost....http://www.thinkgeek.com/sfshirt
> > _______________________________________________
> > iText-questions mailing list
> > [email protected]
> >
>
https://lists.sourceforge.net/lists/listinfo/itext-questions
> > 
>  


        

        
                
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Cr�ez votre Yahoo! Mail sur http://fr.mail.yahoo.com/


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to