python--html to pdf
2016-06-17 00:00
447 查看
[code=language-bash]Debian/Ubuntu To install wkhtmltopdf in a Debian/Ubuntu server, follow this steps(as root): apt-get install wkhtmltopdf apt-get install xvfb echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh chmod a+x /usr/bin/wkhtmltopdf.sh ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf wkhtmltopdf http://www.google.com output.pdf
then :
[code=language-python]pip install pdfkit vim test.py #coding:utf-8 #__author__:Bing import pdfkit pdfkit.from_file('test.html', 'out.pdf') # Generating PDFs from strings and web-pages is equally easy: pdfkit.from_string('Hello!', 'out.pdf') pdfkit.from_url('http://google.com', 'out.pdf')
相关文章推荐
- 排序算法-09-冒泡排序(Bubble Sort)
- 排序算法-11-二分搜索(Binary Search)
- python开发学习-day15(前端部分知识、web框架、Django创建项目)
- 第三章 Python容器:列表、元组、字典与集合
- python开发学习-day16(Django框架初识)
- python中的进程、线程(threading、multiprocessing、Queue、subprocess)
- 5.1 python基础
- python对象释放顺序
- python SQLAlchemy
- python logging 配置
- python学习笔记6-函数变量
- python多线程处理数据
- Python 图像库包
- python
- python学习之路-6 冒泡算法、递归、反射、os/sys模块详解
- python functools.wraps装饰器模块
- Python+Selenium进行UI自动化测试项目中,常用的小技巧2:读取配置文件(configparser,.ini文件)
- 使用python生成本地html文件
- python ssh
- python