conversion to pdf uses QtWebEngine, which needs a suitable graphics backend, which you are missing. Presumably this is some kind of headless VM/container?
Use the env var to tell qt webengine to disable hardware acceleration, as described at
https://doc.qt.io/qt-6/qtwebengine-debugging.html