【问题标题】:Generate PDF having image in header using Phantomjs 1.9.7使用 Phantomjs 1.9.7 生成标题中包含图像的 PDF
【发布时间】:2014-03-18 07:16:39
【问题描述】:

我正在使用 printheaderfooter.js 使用 Phantomjs 1.9.7 从 html 生成 PDF。 我想在标题中显示图像。

    var PhantomJSPrinting = {
        header: {
          height: "1cm",
          contents: function(pageNum, numPages) { 

               return '<img src="https://www.google.com.bo/images/srpr/logo4w.png"  height="0.95cm"/>'; 

          }
      }  };

但是,生成的 PDF 带有空白标题。标题中没有显示图像。

在标题中显示图像的任何解决方案?

【问题讨论】:

    标签: ruby-on-rails phantomjs


    【解决方案1】:

    height 属性似乎不起作用。

    改用 CSS 样式属性。

    return '&lt;img src="https://www.google.com.bo/images/srpr/logo4w.png" style="height:0.95cm" /&gt;';

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2012-04-16
      • 2014-09-29
      • 1970-01-01
      相关资源
      最近更新 更多