HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › TOC More Parameters / Inject CSS classes in TOC
- This topic has 6 replies, 3 voices, and was last updated Aug 23, 2013
11:34:14 byPD4ML.
-
AuthorPosts
-
April 3, 2013 at 12:51#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
April 3, 2013 at 18:40#29277By the link you may find an info, which reveals what is behind
<pd4ml:tag>:
https://pd4ml.com/cookbook/pd4ml_table_of_contents.htmUnfortunately 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.April 4, 2013 at 07:47#29278Thank 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.April 5, 2013 at 14:01#29279Just replied to the request email.
August 22, 2013 at 21:13#29280Hi,
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
August 23, 2013 at 07:12#29281Normally you don’t need/can’t use a CSS class for the TOC – this was a rather special Case.
August 23, 2013 at 11:34#29282Right, 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”. -
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.
