Thank you, Bruno.

The example looks pretty.
However, I see I have to improve my English!!! ;-)

> Oh, you want the image to be in the middle vertically
> and still have some text below. That's more difficult.

No, I want an image to be placed into a cell and afterwards (on the same 'line') some text into the same cell but this text shall be aligned vertically in the middle/centered.
Thus, I tried to set the alignment of the cell to 'ALIGN_MIDDLE' (since the image's height is larger than the text all the cell's content the whole content can be vertically aligned to the middle) but the text is ever placed on the baseline of the cell.

Regards,
Dirk

-------- Original-Nachricht --------
Datum: Fri, 10 Nov 2006 15: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
-------------------------------------------------------------------------
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