1
pdfkitを使用して文字列htmlをpdfファイルに変換しようとしています。これは私が私が例外「str」はオブジェクトが属性デコードを持っていない取得from_string
でしかし pdfkit - 'str'オブジェクトに属性デコードがありません
try:
options = {
'page-size': 'A4',
'margin-top': '0.75in',
'margin-right': '0.75in',
'margin-bottom': '0.75in',
'margin-left': '0.75in',
}
config = pdfkit.configuration(wkhtmltopdf="/usr/local/bin/wkhtmltopdf")
str= "Hello!!"
pdfkit.from_string(str,"Somefile.pdf",options=options,configuration=config)
return HttpResponse("Works")
except Exception as e:
return HttpResponse(str(e))
をやっているものです。どのように私はこれを修正することができます上の任意の提案?私はこれで設定行を交換してみてくださいPythonの3.5.1
完璧! !ありがとう –
しかし、それは私にエラーを与える: wkhtmltopdfがエラーを報告しました: ネットワークエラーのためコード1で終了:ConnectionRefusedError –