Use a PdfPTable.

----- Original Message ----- From: "wang yun" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, April 10, 2006 7:21 PM
Subject: [iText-questions] Question about Vertical Alignments inside ColumnText


Dear Support,

I try to draw a text inside the center of a rectangle.
I need vertical alignment.

Element.ALIGN_MIDDLE doesn't work. Please advice.

yun


Here is the code:

PdfReader reader = new PdfReader("old.pdf");
PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("new.pdf"));
PdfContentByte cb = stamp.getOverContent(1);
PdfWriter writer = stamp.getWriter();

String tmpStr = "TEST 12345 67890";
Phrase phrase = new Phrase(tmpStr);

ColumnText ct = new ColumnText(cb);
ct.setSimpleColumn(phrase, 0, 0, 200, 200, 12,
Element.ALIGN_CENTER );
ct.setAlignment(Element.ALIGN_MIDDLE);
ct.go();

cb.setLineWidth(1f);
cb.rectangle(0,0,200,200);
cb.stroke();

stamp.close();



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to