Use ColumnText.

Paulo 

> -----Original Message-----
> From: bright [mailto:[email protected]] 
> Sent: Monday, July 06, 2009 9:56 AM
> To: [email protected]
> Subject: [iText-questions] Help positioning text
> 
> Hi, I have been trying to use iText to create pdf based on 
> x-y positions that I've stored. I've tried this 
> 
> int x = 100, y = 150;
> String text = "Sample String\nMore String\nLast String";
> PdfContentByte cb = writer.getDirectContent();
> BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, 
> BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
> cb.beginText();
> cb.setFontAndSize(bf, 12);
> cb.moveText(x, y);
> cb.newlineShowText(text);
> cb.endText();
> It works for 1 line text, but it ignores the new line 
> character. I've read about paragraph & phrase but I can't 
> position them based on x-y position. I can have trade off by 
> not using x-y, only use line, but hwo do i position, for 
> example in a letter, recipient's mailing address aligned 
> left, with date aligned right on the same line? eg 
> 
> My Name
> My Street,
> My State, Postcode,
> Country                                                       
>                            01/01/1970
> Please help. Thanks in advance. 


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.


------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to