我有两个问题:
--toc-depth或--toc-l1-font-size。似乎它们在最新的wkhtmltopdf版本中是不可用的--那么我现在如何设置为c深度和toc字体大小呢?- When I create one huge .html file, then the toc is correct (sub-chapter are shown as level-2), but the sub-chapter don't start on a new page.
- When I create multiple .html files instead (one for every sub-chapter) then my sub-chapter do begin on new pages, but they are all shown as toc level-1.
发布于 2016-10-04 08:07:10
ToC定制
在当前版本中,您可以使用XSLT文件自定义生成的ToC的任何样式。以下是文件中的相关引文:
内容表是通过XSLT生成的,这意味着可以将其样式设置为您希望它查看的样式。要了解如何做到这一点,您可以通过提供
--dump-default-toc-xsl来转储默认的xslt文档,并通过提供--dump-outline来处理它的大纲。 可以使用--xsl-style-sheet开关指定XSLT文档。例如: wkhtmltopdf toc -xsl-样式表my.xsl http://qt-project.org/doc/qt-4.8/qstring.html qstring.pdf 可以使用--dump-default-toc-xsl开关将默认的XSLT样式表转储到stdout。这是编写您自己的样式表的一个良好开端。
这就是我为向ToC隐藏特定级别所做的事情。我编辑了XSLT文件,将一个CSS类添加到<li> (默认XSLT中的第40行)和<ul> (第55行)元素中。在这个类名我数了一下祖先节点中获得项的“深度”级别。
<li class="level-{count(ancestor::*) - 1}">
<ul class="level-{count(ancestor::*) - 1}">然后我添加了一些CSS规则,在<style>中添加了<head>。
.level-2, .level-3, .level-4 {
display: none;
}分章节分页符
您可以将<div style="page-break-after: always"></div>放在yout 中,然后将其放在子章节之前,以强制它们出现在新页面上。
https://stackoverflow.com/questions/39846155
复制相似问题