python - 非英语字符集的输出 pdf 中的 Python pdfkit 问题
问题描述
pdfkit 是否支持亚洲语言,我来自印度,所以我的问题与 python 脚本中的印地语和马拉地语有关
我正在使用 pdfkit 成功地以英语从 URL 生成 pdf,但是如果我尝试其他一些非英语语言的 URL,它会在 pdf 中生成一些垃圾字符,我的代码是
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)
我尝试使用示例 URL google.co.in,但它正在打印一些垃圾字符。
你能建议和帮助吗?
谢谢
解决方案
推荐阅读
- swift - 在 Swift 中动画一组 NSView 以在 NSStackView 中一个接一个出现的最佳方式是什么?
- sql - 内存中 DB 到字节
- android - 如何将 Blob(在 Sqlite 中)转换为正确的字符串?
- prolog - Prolog-找到0以上的任何数字
- ruby-on-rails - Rails 6:未初始化的常量 ActionText::Engine::ApplicationController (NameError)
- c - 警告:从不兼容的指针类型赋值 [默认启用] 并从不同大小的整数转换为指针 [-Wint-to-pointer-cast]
- python - 无法在 docker 中导入我编译的 cython 模块
- python - 如何一次填充多列的 Nan 值?
- ios - 检测 UITableView 部分何时滚动出视图
- javascript - 在用 javascript 和 HTML 制作交互式小说游戏时,我应该制作一个大文件还是多个小文件?