Closed olderflower closed 7 months ago
I don't have much experience with weasyprint. I expect the thing to do is make a tiny book with four pages or something, verify that weasyprint gets it wrong, then examine the HTML to work out what it is that weasyprint doesn't like. Or what is missing in the book
case that's present in the article
case.
If you can work out what's confusing weasyprint, I'm happy to try to fix it in the generated HTML.
Thanks for replying so quickly. I will try it in your way. If I need your help I will let you konw. Thank you again.
And could you recommend an open source Paged Media PDF generator to me ?
I don't have much experience with weasyprint. I expect the thing to do is make a tiny book with four pages or something, verify that weasyprint gets it wrong, then examine the HTML to work out what it is that weasyprint doesn't like. Or what is missing in the
book
case that's present in thearticle
case.If you can work out what's confusing weasyprint, I'm happy to try to fix it in the generated HTML.
I'v made a tiny book, and I haven't change any parameters except page-style
. When the parameter page-style
is set to article
, the HTML page was generated by :
xslTNG/bin/docbook -s:pagestyletest.xml -xsl:xslTNG/xslt/print.xsl -o:PageStyle-article.html
and the pdf file was generated by:
weasyprint PageStyle-article.html PageStyle-article.pdf
In the same way, I set the parameter page-style
to book
, and generated the html and pdf file. All the generated files have been attached. Could you help me to examine the HTML files?
PageStyle-article.html.txt PageStyle-article.pdf PageStyle-book.html.txt PageStyle-book.pdf
Thank you for the test cases. I've reproduced the problem. The only significant difference between the HTML files is the class used on the HTML element. Apparently, there's something in the CSS associated with the book-style
that weasyprint doesn't like. Curiously, the error messages are exactly the same in both cases.
With a few minutes of binary searching through the CSS for rules that apply in book-style
, I find that this is the culprit:
html.book-style .book .list-of-titles {
break-before: right;
counter-reset: page;
}
Apparently weasyprint doesn't like that.
When set counter-reset: none;
in the html.book-style .book .list-of-titles
I got the correct result.
https://github.com/Kozea/WeasyPrint/issues/2008
Thank you very much.
Glad you got it working!
I use weasyprint to generate my pdf file. When I use
<xsl:param name="page-style" as="xs:string" select="'article'"/>
, I can get my pdf file correctly with TOC and page number.But when I change
article
tobook
, I cannot get the correct TOC with page number. All the page numbers are '0' in toc, I want to know how to correct it.