python-pdfkit
python-pdfkit copied to clipboard
pdfkit.from_file is not outputting the file content in Arabic!
function:
def converter(filename, output_path=(getcwd() + '\\output\\')):
pdfkit.from_file(f'{output_path}html\\{filename}.html', f'{output_path}pdf\\PDF-{filename}.pdf')
output:
py: 3.8 pdfkit: last wk: last, 64bit
@JazzCore, any help?
@CJSparrow I'm pretty sure that this issue is on wkhtmltopdf
side, since you're passing a file to it. Check README troubleshooting section and then try running it manually through CLI. You can either form command for it yourself or check what command pdfkit
generates and then run it directly from terminal (adapt example for your case):
import pdfkit
r = pdfkit.PDFKit('html', 'string', verbose=True)
print(' '.join(r.command()))
# try running wkhtmltopdf to create PDF
output = r.to_pdf()
HI @CJSparrow
You can try adding these lines in your html, maybe it will help :)
<!DOCTYPE html>
<html lang="fa" style="text-align:right">
<head>
<title>PAGE-1</title>
<meta name="description" content="" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
you can change fa
(farsi) to ar
(arabic)