0

Does pdfkit support asian languages, I am from India, so my question related to languages Hindi and Marathi in python script

I am generating pdf from URL using pdfkit successfully in English language, but it is generating some junk characters in pdf if I try some other non-English languages URL, my code is

options = {
'page-size': 'Letter',
'margin-top': '0.75in',
'margin-right': '0.75in',
'margin-bottom': '0.75in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'custom-header' : [('Accept-Encoding', 'gzip')],
'cookie': [
('cookie-name1', 'cookie-value1'),
('cookie-name2', 'cookie-value2'),
],
'no-outline': None
}
import requests
from bs4 import BeautifulSoup
from urllib import request, response, error, parse
from urllib.request import urlopen
import pdfkit
config=pdfkit.configuration(wkhtmltopdf="c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe")
pdfkit.from_url(URL,'c:\temp\sample.pdf', configuration=config, options=options)

I tried with sample URL google.co.in but it is printing some junk characters.

and my target URL is https://www.loksatta.com/kolhapur-news/politics-on-the-backdrop-of-the-upcoming-elections-of-the-gokul-district-central-co-operative-banks-abn-97-2195442/

Can you pl suggest and help ?

Thanks

0 Answers0