eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.07k stars 1.38k forks source link

How to generate a pdf with a table of contents? #669

Open wml107 opened 12 months ago

wml107 commented 12 months ago

I would like to generate a pdf with a table of contents. The title of the table of contents is dynamically extracted from my content and also needs to correspond to the page number. The current API doesn't seem to be sufficient for me to achieve this, is there any solution?

jmaguirrei commented 5 months ago

Hello @wml107 did you found a solution? I am seeking the same goal

wml107 commented 4 months ago

Hello @wml107 did you found a solution? I am seeking the same goal

I realized this demand through the paged.js, it can not only automatically generate the toc, also can add the header and footer with the page number; He is based on the processing of html, completely independent of the canvas, so it can also support a variety of complex styles; And it works well with the lifecycle of libraries like Vue and React.