Carlos Bergueira wrote:

I know it's a basic question but it's important to me !

It is indeed a very basic question.
You must have overlooked this method in the JAVADOCs:
http://itextdocs.lowagie.com/docs/com/lowagie/text/Paragraph.html#Paragraph(java.lang.String,%20com.lowagie.text.Font)

Font blue = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC, new Color(0x00, 0x00, 0xFF)); Font red = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD, new Color(0xFF, 0x00, 0x00)); Font orange = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC, new Color(0xFF, 0x66, 0x00));

        document.add(new Paragraph("Centered title", blue));
        document.add(new Paragraph("Right...", red));
document.add(new Paragraph("Left...", orange));

I even know what your next question will be:
"Why don't my paragraphs have the alignment I specified?"

Fact is that you create an object called paragraph,
you set the alignment of this paragraph, but you never
ever add any content to it, nor do you add it to the document.

do something like this instead:
Paragraph paragraph;

paragraph = new Paragraph("Centered title", blue);
paragraph.setAlignment(Element.ALIGN_CENTER);
document.add(paragraph);

paragraph = new Paragraph("Right...", red);
paragraph.setAlignment(Element.ALIGN_RIGHT);
document.add(paragraph);

and so on...
br,
Bruno


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to