Did you look at the book and at the examples? ColumnText is a single column but
you can continue the column someplace else, in the same page or in the next
page. Plenty of examples are available.
Paulo
-----Original Message-----
From: Neha Yadav [mailto:[email protected]]
Sent: Monday, March 15, 2010 11:10 AM
To: [email protected]
Subject: [iText-questions] how to use ColumnText
hello,
we used ColumnText as suggested by you we are able to get the
vertical position when we use it for a single page with no columns. But as
we use ColumnText further for a page having two or more column we are not
getting the vertical position. kindly tell us how to do it for a page
containing two or more column.
Like in this code I am getting Yline-
code 1-
PdfContentByte cb = writer.getDirectContent();
ColumnText ct = new ColumnText(cb);
BufferedReader reader =
new BufferedReader(new FileReader("caesar.txt"));
String line;
Create ColumnText object
while ((line = reader.readLine()) != null) {
ct.addText(new Phrase(line + "\n"));
}
reader.close();
ct.setSimpleColumn(36, 36,
PageSize.A4.width() - 36, PageSize.A4.height() - 36
18, Element.ALIGN_JUSTIFIED);
int status = ColumnText.START_COLUMN;
while (ColumnText.hasMoreText(status)) {
status = ct.go();
ct.setYLine(PageSize.A4.height() - 36);
document.newPage();
}
But now I have to add more than 1 column like-
code-2
float[] left = { 36, (PageSize.A4.width() / 2) + 18 };
float[] right = { (PageSize.A4.width() / 2) - 18,PageSize.A4.width() - 36 };
int status = ColumnText.NO_MORE_COLUMN;
int column = 0;
while (ColumnText.hasMoreText(status)) {
ct.setSimpleColumn(left[column], 36,
right[column], PageSize.A4.height() - 36);
status = ct.go();
}
in the code-2 how can I split the text in second column?
Thank You.
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.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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/