Convert to HTML, then use Prince (https://www.princexml.com/) to style and convert to PDF.
Pretty nice to work with, if you can run JS. (The rest is just Puppeteer to print. Though I couldn't use their command line tool, because it force-injects paged.js, and it didn't play well with the Preact components for previewing I had made.)
Edit: I see it's $495 now. I don't think it was priced when I used it, but it's been 4-5 years.