This is first time i'm working with xls , very new at this.
I'm trying this package:
https://github.com/KnpLabs/snappy
To generate pdf file from html page there is an option to add table of content to the pdf ... here is the doc:
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');
Based on what I've read online , xsl file is just an style sheet for xml file, there is no actual data in the xsl file itself
My question is where is the actual data for table of contents coming from ?
There is some default behavior in wkhtmltopdf in which the H
elements are used to generate the Table of Contents. This is achieved by a default XSLT, which you can inspect and override.
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