zoukankan      html  css  js  c++  java
  • 黄聪:wkhtmltopdf解决分页问题

    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>
  • 相关阅读:
    【剑指offer】24.反转链表
    【剑指offer】22. 链表中倒数第k个节点
    【每日一题-leetcode】84.柱状图中最大的矩形
    activity切换动画
    取消ActionBar的方法
    软工概论学习一
    软工概论学习二
    屏幕滑动监测以及触发事件
    Android 动画解释
    shape 学习
  • 原文地址:https://www.cnblogs.com/huangcong/p/5526316.html
Copyright © 2011-2022 走看看