JazzCore / python-pdfkit

Wkhtmltopdf python wrapper to convert html to pdf
MIT License
1.99k stars 329 forks source link

Cannot pass file list to `from_file` module #239

Open TorhamDev opened 1 year ago

TorhamDev commented 1 year ago

Hello.

When I try to use a list of files to create a PDF, I get the following error:

OSError: wkhtmltopdf exited with non-zero code 1. error:
Exit with code 1, due to unknown error.

my code :

from glob import glob
import pdfkit

options = {
    "enable-local-file-access": "",
    "margin-top": "0",
    "margin-bottom": "0",
    "margin-left": "0",
    "margin-right": "0",
    'page-size': 'Letter',
    'encoding': "UTF-8",

}
pdfkit.from_file(glob("*.html"), "out.pdf", options=options) # or ["1.html", "2.html"]

pdfkit : 1.0.0 python : 3.6.13 wkhtmltopdf : 0.12.6