example.
import java.awt.Color;
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class heigfht {
public static void main(String[] args) {
try {
PdfPTable headerTable = new PdfPTable(1);
headerTable.setTotalWidth(100);
float[] widths = {100};
headerTable.setWidths(widths);
String content1 =
"QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ";
String content2 = "dsfdfdfdf";
PdfPCell cell1 = new PdfPCell(new Phrase(content1, new
Font(Font.HELVETICA, 7, Font.NORMAL, Color.black)));
PdfPCell cell2 = new PdfPCell(new Phrase(content2, new
Font(Font.HELVETICA, 7, Font.NORMAL, Color.black)));
headerTable.addCell(cell1);
headerTable.addCell(cell2);
for(int i = 0; i < headerTable.size(); i++)
System.out.println(headerTable.getRowHeight(i));
}
catch(Exception e) {e.printStackTrace();}
}
}
The first row height is 221 and second height is 11. Second one is correct because it
is only one line so 11 should be fine. But for the first one, 221 is too big. I don't
think content1 is displayed in 20 lines.
>
> From: Paulo Soares <[EMAIL PROTECTED]>
> Date: 2003/09/10 Wed AM 09:45:53 EDT
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> Subject: RE: [iText-questions] PdfPTable' row height
>
> I see nothing wrong with it and the height should be right. Prepare a small
> runnable example so that I can test it here.
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
> > Sent: Wednesday, September 10, 2003 14:21
> > To: [EMAIL PROTECTED]
> > Subject: [iText-questions] PdfPTable' row height
> >
> > The following is my codes.
> >
> > PdfPTable table = new PdfPTable(1);
> > table.setTotalWidth(100);
> > float[] widths = {100};
> > table.setWidths(widths);
> > float height = 0;
> > PdfPCell = new PdfPCell(new Phrase(cotent , font)); // content is a big
> > chunk.
> > add cell to table.
> > for(int i = 0; i < table.size(); i++) {
> > height += table.getRowHeight(i));
> > }
> >
> > then getRowHeight returns too big number.
> >
> > >
> > > From: Paulo Soares <[EMAIL PROTECTED]>
> > > Date: 2003/09/10 Wed AM 05:55:33 EDT
> > > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
> > > [EMAIL PROTECTED]
> > > Subject: RE: [iText-questions] PdfPTable' row height
> > >
> > > How are you using the method?
> > >
> > > Best Regards,
> > > Paulo Soares
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
> > > > Sent: Tuesday, September 09, 2003 22:11
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [iText-questions] PdfPTable' row height
> > > >
> > > > I am trying to get PdfPTable's row height, so I used
> > getRowHeight(index)
> > > > method. But if the cell has a big chunk of content like 800
> > characters, it
> > > > returns huge number and it should not. Let's say the content is
> > displayed
> > > > in 12 lines so height should be about 100 but it returns 319. How can
> > I
> > > > use the method correctly?
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This sf.net email is sponsored by:ThinkGeek
> > > > Welcome to geek heaven.
> > > > http://thinkgeek.com/sf
> > > > _______________________________________________
> > > > iText-questions mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions