4

我正在通过gem使用wkhtmltopdf(11.0_rc1) 。wicked_pdf我注意到多列布局不能很好地处理分页符。

我还注意到 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>
4

2 回答 2

1

在此处查看详细的答案和文章:

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

您安装的 wkhtmltopdf 版本可能没有使用 QT 进行修补。

于 2012-05-09T22:00:00.097 回答
0

你可以看到如何安装QT 的补丁版本

它对我有用。并使您的 html 尽可能简单。

于 2012-09-20T06:36:21.687 回答