I tried the options in Is there a script or tool that converts HTML to PDF? with command:
pandoc documentation.html -o test.pdf --pdf-engine=xelatex
but unfortunately they do not preserve the CSS formatting. For example I have this document that looks like this:
but the resulting pdf output looks plain like this without css formatting. Notice that the header with blue background is gone and all the other formatted texts no background css.
chromium --headless --disable-gpu --print-to-pdf=out.pdf documentation.html
sudo apt-get install chromium-browser
and tried again then it suggested i need toinstall snap install chromium
but then it gives meerror: cannot communicate with server: Post "http://localhost/v2/snaps/chromium": dial unix /run/snapd.socket: connect: no such file or directory
maybe because im running ubuntu app WSL on windows 11 :(