xslTNG icon indicating copy to clipboard operation
xslTNG copied to clipboard

Page number is 0 in PDF TOC when using page-style=book with weasyprint

Open fsteimke opened this issue 1 year ago • 3 comments

Hi Norm, up to now i used the Antenna House Formatter for rendering HTML paged media (created with print.xsl instead of docbook.xsl) without problems. But i am sure that many users will not (or can not) purchase a commercial product. I am sure that it must be possible to use the xslTNG Stylesheets with some open-source or cost-free products to get PDF output.

I tried weasyprint and the results are very promising. But there is an issue with page numbers in the TOC (and other target-counter (page) references: they give not the real page number, but a 0 (zero) instead. The good news is: this happens only when i set the page-style parameter to book. Page numbers are correct when article is used as page-style. This means that it is possible in principle, and that there mus be an issue with CSS when in book style.

I have made samples with book style and article style and a fresh installation of xslTNG 2.2.0.

sample.zip

Unfortunately i have only little knowledge about CSS, so i will not be able to make a PR for this issue.

Greetings, Frank

fsteimke avatar Mar 29 '24 11:03 fsteimke

Hello!

The bug is caused by:

html.book-style .book .list-of-titles {
  counter-reset: page;
}

I suppose that the bug is in WeasyPrint … but as always with page counters, I’m not sure yet. 😄

As a workaround, you can override this rule with an extra

html.book-style .book .list-of-titles {
  counter-reset: none;
}

liZe avatar Mar 31 '24 13:03 liZe

See also #433

ndw avatar Mar 31 '24 21:03 ndw

If you’re interested in solving the bug in WeasyPrint (if there’s a bug!), don’t hesitate to open an issue on WeasyPrint’s repository.

liZe avatar Apr 02 '24 14:04 liZe