From time to time people ask about converting html to pdf, and with the removal of wkhtmltopdf in trixie I had the same problem as everyone else (I couldn't find anything sane) so I wrote one. Have a look if you find it useful; I also wrote a manual with it to go along side it
https://wkgtk-html2pdf.com and an online viewer that mirrors the PDF bookmarks (at the same address) so it has undergone extensive dogfooding. There are a few examples of how to use it on github; it has been tested to produce a 2000 page ISO A4 PDF which renders identical to its HTML counterpart and has no ghost pages or drift.