wkhtmltopdf 有个很好的方法,就是在那个div的样式后添加一个:page-break-inside:avoid;就ok了。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>pdf</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style type="text/css">
*{ margin:0px; padding:0px;}
div{ width:800px; min-height:1362px;margin:auto;page-break-inside:avoid;}
</style>
<body>
<div style=" background:#030"></div>
<div style=" background:#033"></div>
<div style=" background:#369"></div>
<div style=" background:#F60"></div>
<div style=" background:#F3C"></div>
<div style=" background:#F0F"></div>
<div style=" background:#0FF"></div>
<div style=" background:#FF0"></div>
<div style=" background:#00F"></div>
<div style=" background:#0F0"></div>
<div style=" background:#033"></div>
<div style=" background:#369"></div>
<div style=" background:#F60"></div>
<div style=" background:#030"></div>
<div style=" background:#033"></div>
<div style=" background:#369"></div>
<div style=" background:#F60"></div>
<div style=" background:#F3C"></div>
<div style=" background:#F0F"></div>
<div style=" background:#0FF"></div>
<div style=" background:#FF0"></div>
<div style=" background:#00F"></div>
<div style=" background:#0F0"></div>
</body>
</html>

黄聪:wkhtmltopdf解决分页问题的更多相关文章

  1. 黄聪:解决Web部署 svg/woff/woff2字体 404错误

    问题:最近在IIS上部署web项目的时候,发现浏览器总是报找不到woff.woff2字体的错误.导致浏览器加载字体报404错误,白白消耗了100-200毫秒的加载时间. 原因:因为服务器IIS不认SV ...

  2. 黄聪:解决丢失api-ms-win-crt-runtime-|1-1-0.dll的问题:vc_redist.x64

    解决无法启动程序,因计算机中丢失api-ms-win-crt-runtime-|1-1-0.dll的问题 安装:Microsoft Visual C++ 2015 RC Redistributable ...

  3. 黄聪:解决Bootstrap模态框(modal)弹出后页面跑到顶部的办法

    bootstrap 3.1.1 版本解决方案: body.modal-open { position: absolute !important; }

  4. 黄聪:Microsoft Enterprise Library 5.0 系列教程(七) Exception Handling Application Block

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(七) Exception Handling Application Block 使用企业库异常处理应用程序模块的 ...

  5. 黄聪:Microsoft Enterprise Library 5.0 系列教程(五) Data Access Application Block

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(五) Data Access Application Block 企业库数据库访问模块通过抽象工厂模式,允许用户 ...

  6. 黄聪:Microsoft Enterprise Library 5.0 系列教程(二) Cryptography Application Block (初级)

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(二) Cryptography Application Block (初级) 企业库加密应用程序模块提供了2种方 ...

  7. 黄聪:Microsoft Enterprise Library 5.0 系列教程(十) Configuration Application Block

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(十) Configuration Application Block 到目前为止,我们使用的模块都是在同一个配置 ...

  8. 黄聪:Microsoft Enterprise Library 5.0 系列教程(八) Unity Dependency Injection and Interception

    原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(八) Unity Dependency Injection and Interception 依赖注入容器Uni ...

  9. 黄聪:《跟黄聪学WordPress插件开发》

    续<跟黄聪学WordPress主题开发>之后,又一个作品完成!<跟黄聪学Wordpress插件开发>,国内最好的Wordpress插件开发视频教程!! 目录预览: WordPr ...

随机推荐

  1. Redis + php扩展的安装与配置(windows)

    -->安装Redis服务 下载redis安装包 http://pan.baidu.com/s/1pJiVFHx 下载后解压 把解压后文件夹里面的文件(根据自己的系统位数选择32位或者64位)拷贝 ...

  2. 学习笔记 DataGridView数据导出为Excel

    DataGridView数据导出为Excel   怎样把WinForm下的“DGV”里的绑定数据库后的数据导出到Excel中. 比如:在窗体里有个一“DGV”,DataGridView1,绑定了数据源 ...

  3. angularJS 报错: [ngModel:numfmt] http://errors.angularjs.org/1.4.1/ngModel/numfmt?p0=333

    <!doctype html> <html ng-app="a10086"> <head> <meta charset="utf ...

  4. SQLServer更新语句要注意

    在SQLServer中 update语句中对于表不能使用别名 eg:update table a set a.column="" where ... 这样在SQLServer中是不 ...

  5. Octopus系列之价格计算公式

    百分比:在原价的基础上优惠5%,相当于95%折销售实际价格:最后实际销售的价格[基准价格:如果有特价就基于特价,没有特价基于原价]优惠金额:减少的金额 批量优惠 百分比: 原价*(1-5%)的算法实际 ...

  6. iOS开发UI篇—Button基础

    iOS开发UI篇—Button基础 一.简单说明 一般情况下,点击某个控件后,会做出相应反应的都是按钮 按钮的功能比较多,既能显示文字,又能显示图片,还能随时调整内部图片和文字的位置 二.按钮的三种状 ...

  7. Solr整合中文分词组件IKAnalyzer

    我用的Solr是4.10版本, 在csdn下载这个版本的IKAnalyzer:IK Analyzer 2012FF_hf1.zip 解压后目录如下: (1)这里还用solr自带的example实验分词 ...

  8. php max_input_vars限制数组大小

    今天做一个项目需要post2000个数组过去,发现一直只能接到一半,后来发现是max_input_vars显示问题. 修改php.ini里面max_input_vars的大小就可以了

  9. Spring配置中的classpath和classpath*的区别

    初学SSH框架,昨天在配置Spring的时候,提示我找不到Spring.xml文件,后面百度之后把classpath改成classpath* 就好了,下面是了解到的简单区别. classpath:只会 ...

  10. Reverse-Daily(2)-wow

    链接:http://pan.baidu.com/s/1eS9JNP4 密码:ltl4 本体分析比较简单,算法是解一个22元一次方程 这里引入了numpy这样一个python库,灰常强大 import ...