wkhtmltopdf Windows下 测试demo 成功
html2pdf 转pdf 中文不换行 然后找到了wkhtmltopdf 支持中文换行 样式也支持
在PHP中生成PDF文件,可以使用 FPDF 和 TCPDF 。但是它们只能用于创建简单的表格,当涉及到需要将图像添加到表中,就无法产生所需的布局。有一个强大的工具叫wkhtmltopdf就能够实现。
Wkhtmltopdf 是一个shell工具,它使用了WebKit渲染引擎和QT,将HTML转换为PDF格式。
wkhtmltopdf 下载地址
http://www.softpedia.com/get/Office-tools/PDF/wkhtmltopdf.shtml
$pdf_tool=dirname(__FILE__).'\bin\wkhtmltopdf';
//exec("D:/xampp/htdocs/test/wkhtmltopdf/bin/wkhtmltopdf bin/ceshi2.html bin/ceshi2.pdf");
exec("$pdf_tool bin/ceshi2.html bin/ceshi2.pdf");
if(file_exists("bin/ceshi2.pdf")){
header("Content-type:application/pdf");
//直接下载
//header("Content-Disposition:attachment;filename='ceshi2.pdf'");
// echo file_get_contents("/tmp/{$filename}.pdf");
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize('bin/ceshi2.pdf'));
//pdf预览模式
header('Content-Disposition: inline; filename="ceshi2.pdf";');
echo file_get_contents('bin/ceshi2.pdf');
//readfile("bin/ceshi2.pdf");
}else{
exit;
}
wkhtmltopdf Windows下 测试demo 成功的更多相关文章
- windows下测试flask的例子tuorial报错flask KeyError: 'DATABASE'
windows下测试flask的例子tuorial报错flask KeyError: 'DATABASE' flask KeyError: 'DATABASE' 提示是 变量 database错误 由 ...
- TensorFlow Object Detection API(Windows下测试)
"Speed/accuracy trade-offs for modern convolutional object detectors." Huang J, Rathod V, ...
- Nacos集群配置实例(windows下测试)
1.首先 fork 一份 nacos 的代码到自己的 github 库,然后把代码 clone 到本地. git地址:https://github.com/alibaba/nacos.git 2.然后 ...
- sphinx全文检索功能 | windows下测试 (一)
前一阵子尝试使用了一下Sphinx,一个能够被各种语言(PHP/Python/Ruby/etc)方便调用的全文检索系统.网上的资料大多是在linux环境下的安装使用,当然,作为生产环境很有必要部署在* ...
- C语言静态库与动态库(Windows下测试)
转载于:https://zhidao.baidu.com/question/1946953913764139388.html,原文为Linux上测试,本文为在Windows上编译测试 我们通常把一些公 ...
- sphinx全文检索功能 | windows下测试 (二)
sphinx 数据库检索需要对数据库重新生成索引,为自己所用,然后按照拆词匹配
- kubernetes实战之consul篇及consul在windows下搭建consul简单测试环境
consul是一款服务发现中间件,1.12版本后增加servicemesh功能.consul是分布式的,可扩展的,高可用的根据官方文档介绍,目前已知最大的consul集群有5000个节点,consul ...
- Python学习笔记(三)windows下安装theano
2016.6.28补充: 不论是实验室的电脑还是我的笔记本,只要是windows下,theano.test()都是不通过的.虽然能使用一些theano中的函数,但是我感觉很不好. 所以还是转Ubunt ...
- windows 下 node 多版本管理工具 - gnvm
最近写了各个构建工具, 开发环境为mac,需要在windows下测试通过: 因为很久不用windows,windows下的node 版本还是 0.10.* 的,因此决定升级node mac 下我使用的 ...
随机推荐
- Miscosoft Visual Studio项目guid取值
There isn't an easy way to change the type of a project in Visual Studio project once it is created; ...
- HBase架构解析
Hbase组件  客户端Client 整个HBase集群的入口 使用HBase RPC机制与HMaster和HRegionserver通信 与HMaster通信进行管理类的操作 与HRegionse ...
- swift 3 发送 HTTP 请求函数
private func HttpPost(requestURL:String, postString:String) -> [String : AnyObject] { return Http ...
- Node 抓取非utf-8编码页面
代码示例 Nodejs抓取非utf8字符编码的页面 -- Ruby's Louvre var http = require('http'); var iconv = require('iconv-li ...
- [Linux] ssh免密码登录
目标:本地机器ssh登录远程目标机器时不用输入密码 (默认状态下,ssh user@192.xxx.x.xxx需要输入密码) 原理:通过公钥和私钥实现系统认证 实现:把本地机器的公钥复制到目标机器 具 ...
- Python IDLE 的使用与调试
Python IDLE 是Python 安装包自带的集成开发环境.IDLE集成了Python 解释器.编辑器与调试器.适用于初学者了解Python 语法知识.1.使用 Python IDLE 编辑Py ...
- caffe 学习记录1及网络结构
ubuntu git clone 默认在当前文件夹 caffe 基础了解:https://www.zhihu.com/question/27982282/answer/39350629 当然,官网才是 ...
- org.hibernate.hql.QueryExecutionRequestException:org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations【异常】
springData学习资料 [http://blog.csdn.net/lw_power/article/details/51296353] [JPA报错]org.springframework.w ...
- Filter学习(一)
一.Filter简介 Filter:可以对web服务器管理的所有web资源(如Jsp, Servlet, 静态图片文件或静态 html 文件等)进行拦截,从而实现一些特殊的功能.例如实现URL级别的权 ...
- .NET中的那些受特别对待的类型(CriticalFinalizerObject)
转自:http://www.cnblogs.com/yuyijq/archive/2009/08/09/1542435.html 股票里面有个ST股,就是Special Treatment的意思.就是 ...