2

I am trying to add a table of contents with page numbers to a PDF I am generating using Freemarker -> HTML -> PDF. The HTML/CSS are below

ul.toc a::after {
    content: " Page " target-counter(attr(href url), page)
}
<ul class="toc">
    <li><a href="#first-section">First Section</a></li>
    <li><a href="#second-section">Second Section</a></li>
</ul>

However when I ran iText7 on this I got this error:

Content property "" Page " target-counter(attr(href url), page)" is either invalid or uses unsupported function."

which comes from CssContentPropertyResolver.java.

Are there any intentions to eventually support this CSS property?

For any documents that require a numbered table of contents, we are forced to use iText5, which does support target-counter. It would be very beneficial if you could reimplement this functionality in iText7

  • Hi Juan Philippe, are you a customer of iText Software? For feature requests it's best if you contact iText Software directly. Stack Overflow is for community support only - see https://stackoverflow.com/help/product-support. – Amedee Van Gasse Oct 06 '20 at 08:16
  • Hi @Juan, are you use `target-counter` is supported in iText 5. I don't think it is. For support of `target-counter` in iText 7, you are right that it's not supported now but stay tuned, it might come in the near future! – Alexey Subach Oct 07 '20 at 19:17

0 Answers0