Headless Chrome to print pdf

前端 未结 7 1393
渐次进展
渐次进展 2020-12-30 15:33

I am trying to use Headless feature of the Chrome to convert a html to pdf. However, i am not getting output at all. Console doesn\'t show any error as well. I am running be

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-30 15:44

    extending the brilliantly simple answer by suraj, I created a small function that is in my sourced path so it works like a CLI tool:

    function webtopdf(){
        chromium-browser --headless --disable-gpu --print-to-pdf=$2 $1
    }
    

    so a quick

    webtopdf https://goo.com/some-article some-article.pdf
    

    does the job for me now

提交回复
热议问题