Thanks, but I don't understand. I give you more information...
If you see the code below, my doubt is in the line:
Location to wkhtmltopdf
config = pdfkit.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
I have to set the path to wkhtmltopdf file in Pythonanywhere. The path you see is my local machine. How I install wkhtmltopdf in Pythonanywhere?
myfunction.py:
import pdfkit
def create_pdf_invoice(invoice):
...stuffs...
# Location to wkhtmltopdf
config = pdfkit.configuration(wkhtmltopdf='/usr/local/bin/wkhtmltopdf')
# CSS to add to template
css = os.path.join(conf_settings.STATIC_ROOT, 'shop', 'css', 'invoice-pdf.css')
# Saving the File
filepath = os.path.join(conf_settings.MEDIA_ROOT, 'invoice/')
pdf_save_path = filepath+filename
# Save the PDF
pdfkit.from_string(html, pdf_save_path, css=css, configuration=config, options=options)