测试一下
wkhtmltopdf http://www.baidu.com baidu.pdf
"Done"表明顺利完成,当前目录下出现一个baidu.pdf,打开,正是百度首页。
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django_extensions',
'django.contrib.staticfiles',
'tastypie',
'testproduct',
# 'djangular',
'test_without_migrations',
'wkhtmltopdf',
'mptt',
'rest_framework.authtoken'
# 'import_export',
)
# 将html转成pdf
# This is the options of wkhtmltopdf
WKHTMLTOPDF_CMD = os.path.join(PROJECT_PATH, 'bin/wkhtmltopdf')
WKHTMLTOPDF_CMD_OPTIONS = {
# 'page-size': 'Letter', 'margin-top': 10, 'margin-bottom': 10
'quiet': True,
}
ubuntu中文支持,及中文乱码问题
状况:所用的Linux系统不支持中文,遇见中文就zz了。ORZ…
目标:使系统/服务器支持中文,能够正常显示。
首先,安装中文支持包language-pack-zh-hans:
sudo apt-get install language-pack-zh-hans
然后,修改/etc/environment(在文件的末尾追加):
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
再修改/var/lib/locales/supported.d/local(没有这个文件就新建,同样在末尾追加):
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
最后,执行命令:
sudo locale-gen
对于中文乱码是空格的情况,安装中文字体解决。
sudo apt-get install fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming
---------------------
作者:Whowell
来源:CSDN
原文:https://blog.csdn.net/weixin_39792252/article/details/80415550
版权声明:本文为博主原创文章,转载请附上博文链接!