I Have an HTML code in which some texts are in the Hindi language. When I am converting the HTML file to PDF using weasyprint library, The generated PDF looks something like this:
This is my code for conversion:
from weasyprint import HTML
output = open('kt.html', 'rb')#, encoding='utf-8')
html = HTML(output)
html.write_pdf(target='ouput.pdf')
Tried using encoding also, but got this error:
TypeError: Cannot set an encoding with a unicode input, set ['override_encoding', 'transport_encoding']
How to solve this issue?
EDIT:
HTML code looks something like this:
and HTML browser preview looks something like this