Hi! Obviously I made a mistake - that's why I was asking for help. And no, i was not kidding, I did find examples, but couldn't solve my problems with them. Anyway, thanks for your help, I'll give it a shot tomorrow! Cheers, Reinhard
Am 21.01.2009 um 21:18 schrieb 1T3XT info: > Reinhard Prechtl wrote: >> Hello! >> >> I’m using iText to construct a pdf-document. My document consists of >> serveral paragraphs, which should have differend indentations. I >> looked >> up the respective methods in the documentation, but i can’t make >> indentation work. Also, i didn’t find any hints on the mailinglist or >> elsewhere. > > You must be kidding! I found an example in less than 5 seconds: > http://1t3xt.info/examples/browse/?page=example&id=47 > Why, it from the book on iText! (What a surprise!) > >> So that’s what i’m doing: >> >> <code> >> // Document with margins >> >> Document doc = new Document(PageSize.A4, 20.0f, 20.0f, 20.0f, 20.0f); >> […] >> Font bold = new Font(Font.HELVETICA, FONTSIZE_NORMAL, Font.BOLD); >> p = new Paragraph(); >> p.setFont(normal); >> p.add(new Chunk("headline", bold)); >> p.add(Chunk.NEWLINE); > > document.add(p); > >> Paragraph p2 = new Paragraph(); >> p2.setFont(normal); >> p2.setIndentationLeft(40.0f); >> p2.add(new Chunk("some text"))); >> p2.add(Chunk.NEWLINE); > > // HEY! WHAT IS THIS? Who told you to do this? >> // p.add(p2); > > document.add(p2); > >> </code> >> >> I would expect that the two paragraphs would have different >> indentations, > > Why? > >> but nothing happens. > > Actually something DOES happen: the properties of p2 get lost in favor > of the properties of p. > -- > This answer is provided by 1T3XT BVBA > http://www.1t3xt.com/ - http://www.1t3xt.info > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > 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 ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ 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
