zoukankan      html  css  js  c++  java
  • Python pdfkit制作电子书

    IOError: No wkhtmltopdf executable found: ""

    从https://wkhtmltopdf.org/downloads.html下载wkhtmktopdf安装

    import pdfkit

    config = pdfkit.configuration(wkhtmltopdf=r"C:Program Fileswkhtmltopdfinwkhtmltopdf.exe") pdfkit.from_file(filename, fname, configuration = config) # fname = "xx.pdf"

    File "/usr/local/lib/python2.7/dist-packages/pdfkit/pdfkit.py", line 119, in to_pdf raise IOError("wkhtmltopdf exited with non-zero code {0}. error: {1}".format(exit_code, stderr.decode("utf-8"))) IOError: wkhtmltopdf exited with non-zero code 1. error:

    尝试了下,实际上上是有输出的,获取异常跳过,不过问题可能是wkhtmltopdf的版本和系统,相关的问题

    import pdfkit
    try:
    config = pdfkit.configuration(wkhtmltopdf=r"C:Program Fileswkhtmltopdfinwkhtmltopdf.exe")
    pdfkit.from_file(filename, fname, configuration = config) # fname = "xx.pdf"
    except:
    continue
     
  • 相关阅读:
    关于codeblocks插件(持续更新)
    自定义gvim配色方案qiucz.vim的源码
    mark it
    poj 1032
    poj 1028
    最小公倍数是lcm
    problems
    hdu 1067
    某些题的做法。。。
    突然明白了什么
  • 原文地址:https://www.cnblogs.com/leilei-weapon/p/12448814.html
Copyright © 2011-2022 走看看