wkhtml2pdf可以支持CSS计数器吗?

时间:2015-02-17 23:56:16

标签: wkhtmltopdf

我在HTML中有反复位和反增量工作正常,但它们没有出现在渲染的PDF中。他们支持吗? (一小时的谷歌搜索并没有帮助。)

这是我的CSS。同样,这在HTML中运行良好,但不会出现在PDF中。

body {
 counter-reset: h3counter 1;
 counter-reset: h4counter 1;
}

h2 {
  counter-reset: h3counter;
}

h3 {
  counter-increment: h3counter;
  counter-reset: h4counter;
}

h3:before {
  content: counter(h3counter) ".\0000a0\0000a0";
}

h4 {
  counter-increment: h4counter;
}

h4:before {
  content: counter(h3counter) "." counter(h4counter) ".\0000a0\0000a0";
}

1 个答案:

答案 0 :(得分:0)

是的,它有效(在wkhtmltox.dll版本0.11.0.0中),但仅限于简单情况。我刚刚碰到了当标题标签(h1,h2,h3)不是直接兄弟时计数器似乎重置的问题 - 即每个都包裹在div中。当标题相邻时,如:

<h2>..</h2>
<h3>...</h3>
<h3>...</h3>

wkhtmltopdf数字正确;在这种情况下:

<h2>...</h2>
<div>
  <h3>...</h3>
</div>
<div>
  <h3>...</h3>
</div>

它没有。两个h3的号码相同。

相关问题