Dirk Ulrich wrote:
  Why does an indentation of a section indent an "outer" section as well?

It doesn't. See the attached example.
You'll have to rephrase your question if you
are having a problem with Chapters/Sections.

I have a Section just showing a numbering and a title. Within this section I have another Section and I want to indent this section. If I set an indentation to this "inner" section, the outer section is indented as well.

Here's what I intend to do:
1. Outer Section 1
    1.1 Inner Section 1
    1.2 Inner Section 2
    1.3 Inner Section 3

2. Outer Section 2
...

A code sample would help.
br,
Bruno
package test;

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Chapter;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Section;
import com.lowagie.text.pdf.PdfWriter;

public class Dirk {
        public static void main(String[] args) {
                Document document = new Document();
                try {
                        PdfWriter.getInstance(document, new 
FileOutputStream("dirk.pdf"));
                        document.open();
                        Chapter chapter1 = new Chapter("Chapter 1", 1);
                        Section section1 = chapter1.addSection(20, "Section");
                        section1.add(new Paragraph("blah blah blah"));
                        Paragraph title1 = new Paragraph("subsection 1");
                        title1.setIndentationLeft(20);
                        Section subsection1 = section1.addSection(20, title1);
                        subsection1.add(new Paragraph("blah blah blah"));
                        Paragraph title2 = new Paragraph("subsection 2");
                        title2.setIndentationLeft(20);
                        Section subsection2 = section1.addSection(20, title2);
                        subsection2.add(new Paragraph("blah blah blah"));
                        Section section2 = chapter1.addSection(20, "Section");
                        section2.add(new Paragraph("blah blah blah"));
                        document.add(chapter1);
                        Chapter chapter2 = new Chapter("Chapter 2", 2);
                        chapter2.setTriggerNewPage(false);
                        document.add(chapter2);
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (DocumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                document.close();
        }
}

Attachment: dirk.pdf
Description: Adobe PDF document

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to