I copied the section logic out of the itext api html docs and all pdf shows is
the chapters, no sections.



            doc = new Document(PageSize.A4, 50, 50, 50, 50);
            PdfWriter.getInstance(doc, new FileOutputStream("c:/try2.pdf"));
            Paragraph phrase = new Paragraph("Hello World");
            HeaderFooter hd = new HeaderFooter(phrase, false);
            doc.setHeader(hd);
            HeaderFooter foot = new HeaderFooter(new Paragraph("Created by 
usacoder"),
true);
            doc.setFooter(foot);
                    
            doc.open();
            doc.add(new Paragraph("new paragraph");
            
            Paragraph title2 = new Paragraph("This is Chapter 2",
FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0,
255)));
            Chapter chapter2 = new Chapter(title2, 2);
            doc.add(chapter2);
            Paragraph someText = new Paragraph("This is some text");
            chapter2.add(someText);
            Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2",
FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 
0)));
            Section section1 = chapter2.addSection(title21);
            Paragraph someSectionText = new Paragraph("This is some silly
paragraph in a chapter and/or section. It contains some text to test the
functionality of Chapters and Section.");
            section1.add(someSectionText);
            Paragraph title211 = new Paragraph("This is SubSection 1 in Section
1 in Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLD, new
Color(255, 0, 0)));
            Section section11 = section1.addSection(40, title211, 2);
            section11.add(someSectionText);
            doc.newPage();
                
            doc.close();


-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to