生成的 pdf (snappy/wkhtmltopdf) 中缺少 table 内容的 xsl 数据

Missing xsl data for table of content in the generated pdf (snappy/wkhtmltopdf )

这是我第一次使用 xls ,对此非常陌生。

我正在试用这个套餐:

https://github.com/KnpLabs/snappy

要从 html 页面生成 pdf 文件,可以选择将 table 内容添加到 pdf 中...这是文档:

If you want to generate table of contents and you want to use custom XSL stylesheet, do the following:

$snappy = new Pdf('/path/to/binary');

$snappy->setOption('toc', true);
$snappy->setOption('xsl-style-sheet', 'http://path/to/stylesheet.xsl') //or local file;

$snappy->generateFromHtml('<p>Some content</p>', 'test.pdf');

根据我在网上看到的,xsl文件只是xml文件的一种sheet样式,xsl文件本身没有实际数据

我的问题是 table 内容的实际数据来自哪里?

wkhtmltopdf 中有一些默认行为,其中 H 元素用于生成内容的 Table。这是通过 default XSLT 实现的,您可以检查和覆盖它。

https://wkhtmltopdf.org/usage/wkhtmltopdf.txt

Table Of Contents:

A table of contents can be added to the document by adding a toc object to the command line. For example:

wkhtmltopdf toc https://doc.qt.io/archives/qt-4.8/qstring.html qstring.pdf

The table of contents is generated based on the H tags in the input documents.

The --dump-default-toc-xsl switch can be used to dump the default XSLT style sheet to stdout. This is a good start for writing your own style sheet

wkhtmltopdf --dump-default-toc-xsl