HTML to PDF converter for Java and .NET

<< back

PD4ML Table Of Contents

PD4ML supports automatic TOC generation with a proprietary tag <pd4ml:toc> The tag builds TOC table from H1-H6 headings structure.

The result looks like that:

On practice you may face with a necessity to suppress some minor TOC levels, or to remove paging info of major TOC levels.

It can be achieved via an applying of CSS style to relevant elements.

PD4ML replaces <pd4ml:toc> tag with a table like the following:

<table class="ptoc-table" cellspacing="0">
<tr class="ptoc1-row">
    <td class="ptoc-left-col"><a class="ptoc-link" href="#ptoc_1">
        <div class="ptoc1-style-left">Chapter 1<pd4ml-dots></div></a></td>
    <td class="ptoc-right-col"><a class="ptoc-link" href="#ptoc_1">
        <div class="ptoc1-style-right">1</div></a></td></tr>
<tr class="ptoc2-row">
    <td class="ptoc-left-col"><a class="ptoc-link" href="#ptoc_2">
        <div class="ptoc2-style-left">Chapter 1.1<pd4ml-dots></div></a></td>
    <td class="ptoc-right-col"><a class="ptoc-link" href="#ptoc_2">
        <div class="ptoc2-style-right">2</div></a></td></tr>
<tr class="ptoc2-row">
    <td class="ptoc-left-col"><a class="ptoc-link" href="#ptoc_3">
        <div class="ptoc2-style-left">Chapter 1.2<pd4ml-dots></div></a></td>
    <td class="ptoc-right-col"><a class="ptoc-link" href="#ptoc_3">
        <div class="ptoc2-style-right">2</div></a></td></tr>
<tr class="ptoc3-row">
    <td class="ptoc-left-col"><a class="ptoc-link" href="#ptoc_4">
        <div class="ptoc3-style-left">Chapter 1.2.1<pd4ml-dots></div></a></td>
    <td class="ptoc-right-col"><a class="ptoc-link" href="#ptoc_4">
        <div class="ptoc3-style-right">3</div></a></td></tr>
In order to suppress page number info for, let's say, level H3, an obvious CSS approach is
div.ptoc3-style-left pd4ml-dots, div.ptoc3-style-right {visibility: hidden}

Another way is to apply a special CSS property to H3 tags itself: 

H3 {pd4toc: nopagenum}

That also allows you to apply the property to individual H3 tags. For example: <h3 pd4toc="nopagenum">

If you need to completely remove some TOC levels, here is a solution:

TR.ptoc3-row { display: none; visibility: hidden }
Copyright ©2004-22 zefer|org. All rights reserved. Bookmark and Share