2

I am generating PDF using iText and XMLWorker. There problem is we need to generate the TOC for the PDF with page no. I am having mt section headings in a list. With this list i can generate the TOC without page no. But our requirement is we need page no also. Below is my list containing section details.

List<String> sectionList=new ArrayList<String>();
sectionList.add("Section1");
sectionList.add("Section2");
sectionList.add("Section3");
sectionList.add("Section4");
sectionList.add("Section5");`

My CLOB object is

String pdfString="<h1>Section1</h1><p>Some content for section1</p>" +
            "<h1>Section2</h1><p>Some content for section2</p>" +
            "<h1>Section3</h1><p>Some content for section3</p>" +
            "<h1>Section4</h1><p>Some content for section4</p>" +
            "<h1>Section5</h1><p>Some content for section5</p>";

Section contents will be more than 1 page so we need the page no in TOC. is there any wat to achieve this. NOTE This is a sample we have many sections and subsections.

Sathesh S
  • 1,253
  • 3
  • 23
  • 54

1 Answers1

0

As of the XML Worker 5.5.4 source, it doesn't seem to create "Chapters" anywhere which is required for creating the table of contents. You can create your own tag and build into XML Worker how to process it. Some browsers may ignore an unknown tag and not display it, so be careful.

How to generate a Table of Contents “TOC” with iText?

JavaDoc method for telling XML Worker how to process a new Tag

Community
  • 1
  • 1
rveach
  • 2,081
  • 15
  • 25