Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26832

    We are using PD4ML with a Volume License to create a multipage PDF.
    At the start of the PDF we wish to add a table of contents with the following Format:

    1. [Title] … [Page Number]
    2. [Title] … [Page Number]

    and so on.
    This works (in a way) by using a chapter title like “<h1>1. Title</h1>”.
    The Problem appears when there are more than 10 main titles and the numbers are not aligned anymore.

    eg:
    9. [Title] …
    10. [Title] …

    Now to my questions:

    Is there a way to inject a CSS class into the TOC?
    I tried wrapping the number into a <div> and tag but these are apparently stripped for the TOC.

    Since this should be a pretty frequent request could you extend the TOC tag to automatically number the entry’s when a boolean parameter is true?
    Subentry’s could be numbered 1.1 …

    Another good way to do this and not mess up already numbered titles would be to add a chapter title tag and include a numbering parameter that either generates or accepts a number.
    This number would have a styleable CSS class and would be respected by the TOC.

    Or is there another way to solve this problem?

    Thanks,

    David

    #29277

    By the link you may find an info, which reveals what is behind <pd4ml:tag>:
    https://pd4ml.com/cookbook/pd4ml_table_of_contents.htm

    Unfortunately the only workaround for the number alignment problem is like that:

    <html>
    <head>
    <style>
    .ptoc1-style-left, .ptoc3-style-left, .ptoc3-style-left {
    font-family: monospace;
    }
    </style>
    </head>
    <body>
    <pd4ml:toc>
    <hr>
    <h1> 1. Line 1</h1>
    
    <h1> 2. Line 2</h1>
    
    <h1>10. Line 10</h1>
    
    <h1>40. Line 40</h1>
    </body>
    </html>

    Unfortunately the workaround has its drawbacks:   entities slightly shift chapter names in the the main document, and TOC printed with “Courier New” does not always look matching the main document style.

    An implementation of a proprietary numbering attribute for <h1> - <h6> is possible. Please contact support pd4ml com for that. If you are ready to partially fund the implementation – it will speed up the process.

    #29278

    Thank you for the quick reply.
    Unfortunately the proposed solution will not work for us as we are not allowed to change the used font.
    I will write a feature request email.

    #29279

    Just replied to the request email.

    #29280

    Hi,

    Should i just include <pd4ml:toc> tag in my html to support TOC or should i define a stylesheet as well.

    Please let me know this it will be of great help thanks

    #29281

    Normally you don’t need/can’t use a CSS class for the TOC – this was a rather special Case.

    #29282

    Right, in most of the cases you would only need to add <pd4ml:toc> tag where you want to see a table of contents. CSS style is for a “fine tuning”.

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.