Use a PdfPTable.
Best Regards,
Paulo Soares
> -----Original Message-----
> From: Jaladurgam, Ramana [SMTP:[EMAIL PROTECTED]
> Sent: Tuesday, November 04, 2003 16:54
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Rendering a bounded text
>
> Greetings!!!
> I wanted to render a text into a rectangular boundary.
> Something like:
>
>
>
>
> I know the boundaries of the rectangle in terms of lowerXY and upperXY
> co-ordinates.
>
> I tried using ColumnText, but the results I am getting are differnt. I
> thought of preparing a boundary of (0,0) and (100,100) and embed the text
> inside.
>
> But in the result, the text started from the top of the boundary.
>
> I am attaching the code-snippet and the pdf file too. I am looking for
> suggestions to correct the problem. My thought goes like i will get the
> intended result if vertical alignment can be set through ColumnText, which
> i couldn't find.
>
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> import java.io.*;
>
> public class Test
> {
> public Test()
> {
> try
> {
> Document lDocument = new Document();
> lDocument.setPageSize(com.lowagie.text.PageSize.LETTER);
> PdfWriter lPdfWriter = PdfWriter.getInstance(lDocument
> , new
> FileOutputStream(
> "Rectangle-Test.pdf"));
> lDocument.open();
> PdfContentByte lPdfContentByte =
> lPdfWriter.getDirectContent();
> lPdfContentByte.rectangle(0 , 0 , 100 , 100);
> lPdfContentByte.stroke();
> ColumnText lColumnText = new ColumnText(lPdfContentByte);
> Phrase lPhrase = new Phrase("A phrase of text A phrase of
> text");
> lColumnText.setSimpleColumn(lPhrase , 0 , 0 , 100 , 100 , 0 ,
> Element.ALIGN_CENTER);
> lColumnText.go();
>
> lDocument.close();
> }
> catch(Exception lException)
> {
> lException.printStackTrace();
> }
>
> }
> public static void main(String[] args)
> {
> Test test1 = new Test();
> }
>
> }
>
>
>
>
>
> Regards
> Ramana.JV.
>
>
>
> **************************************************************************
> **
>
> This email may contain confidential
> material. If you were not an intended recipient,
> Please notify the sender and delete all copies.
> We may monitor email to and from our network.
>
>
> **************************************************************************
> *
>
> << File: Outlook.bmp >> << File: Rectangle-Test.pdf >>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions