See the attached GIF to see what I want to achieve (the first cell with the traffic light).

Regards,
Dirk

-------- Original-Nachricht --------
Datum: Fri, 10 Nov:10:23 +0100
Von: "Bruno Lowagie (iText)" <[EMAIL PROTECTED]>
An: Post all your questions about iText here <itext-questions@lists.sourceforge.net>
Betreff: Re: [iText-questions] Vertical alignment

Dirk Ulrich wrote:
> I want to put an image and a text into one PdfPCell of a PdfPTable.

OK, piece of cake, see attachment.

> The vertical alignment of the text shall be middle to the image (which
> shall be placed on the left). Between the image and the following text
> there shall be some space.

Oh, you want the image to be in the middle vertically
and still have some text below. That's more difficult.
Can't you play with the leading?
For instance: define a fixed width for the cell,
based on the height of the image. Then add the image
at the correct position using the leading, then add
some text with a certain leading.

> Using this code, the text after the image is placed on the baseline:

I don't see any padding, nor do I see setUseDescender anywhere.

> I have also tryed to put image and text in a separate cell of a table of
> four cells and to set the rightBorderWidth of the first and the
> leftBorderWidth of the second cell to 0. This ends up in a ta ble with a
> thinner outer border for the first both cells. ???

Setting the border width to 0 doesn't mean you remove
the borders. As is explained in the PDF Reference AND
in 'iText in Action', a width of 0 means you want to
draw the thinnest line possible (depending on the device).

If you want to remove the border: use setBorder(NO_BORDER);

> BTW: If I add a value to a PdfPCell and then try to ADD a further value
> with PdfPCell.add(...) the first value will be replaced instead of being
> added as expected. This method should be named setValue or put or so,
> shouldn't it? The add method should really add something to the already
> existing value of this cell. What do you think about this?

This is normal behavior.
You are m ixing 'text mode' with 'composite mode'.
Ah, tomorrow I will be a happy man, because then I will
be able to say: it's all documented in the book 'iText
in Action'. The eBook version is available here:
http://www.manning.com/affiliate/idevaffiliate.php?id=223_53

If I have some more time, I'll adapt my example
so that it matches your requirements.
br,
Bruno



--
Mit freundlichen Grüßen

Dirk Ulrich
Jansenstraße Berlin
fon:0++49-(0)30-40 999 087
mobil:++49-(0)174/948 87 39

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Attachment: cellalignmentExample.GIF
Description: GIF image

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to