加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – wkhtmltopdf:分页符和多列布局不起作用

发布时间:2020-12-17 02:00:52 所属栏目:百科 来源:网络整理
导读:我通过wicked_pdf gem使用wkhtmltopdf(11.0_rc1).我注意到多列布局不适合分页符. 我还注意到CentOS(在Heroku上)和Windows之间的行为有所不同.在Windows上,在某些情况下可以使用分页符. 你以前遇到过这样的问题吗?任何帮助都非常感谢. html xmlns="http://ww
我通过wicked_pdf gem使用wkhtmltopdf(11.0_rc1).我注意到多列布局不适合分页符.

我还注意到CentOS(在Heroku上)和Windows之间的行为有所不同.在Windows上,在某些情况下可以使用分页符.

你以前遇到过这样的问题吗?任何帮助都非常感谢.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type='text/css'>
      .page {
        page-break-after:always !important;
        clear:both;
        display:block;
      }

      #content {
        width: 800px;
      }
    </style>
  </head>

  <body>
    <div id="content">
      <div class="page">
        <div style="float:left;width:200px;">
          DESCRIPTION 1
        </div>

        <div style="float:left;">
          PIE CHART IMAGE 1
        </div>        
      </div>

      <div class="page">
        <div style="float:left;width:200px;">
          DESCRIPTION 2
        </div>

        <div style="float:left;">
          PIE CHART IMAGE 2
        </div>        
      </div>

      <div class="page">
        <div style="float:left;width:200px;">
          DESCRIPTION 3
        </div>

        <div style="float:left;">
          PIE CHART IMAGE 3
        </div>        
      </div>

    </div>
  </body>
</html>

解决方法

看看这里的答案和文章:

https://github.com/mileszs/wicked_pdf/issues/96

您安装的wkhtmltopdf版本很可能没有使用QT修补.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读