How can I automate HTML-to-PDF conversions?

后端 未结 14 918
攒了一身酷
攒了一身酷 2020-12-23 19:29

I\'ve been using htmldoc for a while, but I\'ve run into some fairly serious limitations. I need the end solution to work on a Linux box. I\'ll be calling this library/utili

14条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 20:13

    Here is a nice easy-to-install version of headless Chrome:

    https://www.npmjs.com/package/chrome-headless-render-pdf

    Unlike "standard" headless chrome, this does not show the annoying auto-generated headers and footers!

    Or there is unoconv (which uses LibreOffice behind the scenes) can make pdfs from html:

    unoconv -f pdf mypage.html

    You can install it on most Linux flavours via the package manager, e.g. apt-get install unoconv

    That's nice and easy for simple files. If you need javascript of css support, then use headless Chrome.

提交回复
热议问题