Frank Fischer wrote:
I use DirectContent and would like to write underlined text to a
specific position. For normal text i use:
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("test.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
cb.beginText();
BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
cb.setFontAndSize(bf, 10);
cb.showTextAligned(PdfContentByte.ALIGN_LEFT, "text", 10, 10, 0);
Now i could not find a way to make a BaseFont underlined. In the Font
class, there is a related method to underline the text, but i can not
set Font with cb.setFontAndSize().
No, class Font is a convenience class wrapped around BaseFont.
It can only be used in objects such as Paragraph, Phrase, Chunk,...
<> Could please someone give a hint, how i can solve that issue?
You can use ColumnText. You can add all kinds of objects to
a ColumnText object, including underlined Chunks of text.
Place the ColumnText at the absolute position and you're done.
Or you can draw the line yourself using moveTo, lineTo and stroke
commands.
br,
Bruno
-------------------------------------------------------
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