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.htmlsudo apt-get install chromium-browserand tried again then it suggested i need toinstall snap install chromiumbut then it gives meerror: cannot communicate with server: Post "http://localhost/v2/snaps/chromium": dial unix /run/snapd.socket: connect: no such file or directorymaybe because im running ubuntu app WSL on windows 11 :(