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.
--
View this message in context:
http://www.nabble.com/Help-positioning-text-tp24351943p24351943.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
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/