python转html页面为pdf

发布时间:2019-07-03 12:50:43编辑:auto阅读(1613)

    python转html页面为pdf:

    安装wkhtmltopdf略

    apt-get install python-pip

    pip install pdfkit

    vi aa.py

    #!/usr/bin/python

    import pdfkit

    pdfkit.from_url('http://google.com','baidu.pdf')

    :wq

    python aa.py

    pdfkit.from_string('hello,python','baidu.pdf')

    pdfkit.from_file('aa.html','baidu.pdf')

关键字