【问题标题】:How to set the header background color in TCPDF?如何在 TCPDF 中设置标题背景颜色?
【发布时间】:2013-12-11 11:47:57
【问题描述】:

各位大佬,如何设置TCPDF中标题的背景颜色?

我试过这个。抱歉,我对 TCPDF 很陌生:

function Header () {
  $this->setFillColor();
  $this->Rect();
}

我最终没有标题和棕色的 pdf 页面。

【问题讨论】:

    标签: php tcpdf


    【解决方案1】:

    您可以在rect方法中直接设置填充颜色。这个例子画了一个绿色的标题:

    public function Header() { $this->Rect(0, 0, 2000, 20,'F',array(),array(20, 255, 100)); }

    TCPD 在代码本身中拥有最好的文档。看看 rect() 参数:

    • $x (float) 左上角横坐标。
    • $y (float) 左上角坐标。
    • $w (float) 宽度。
    • $h (float) 高度。
    • $style (string) 渲染风格。有关详细信息,请参阅 getPathPaintOperator() 函数。
    • $border_style (array) 矩形的边框样式。
    • $fill_color (array) 填充颜色。格式:数组(GREY) 或数组(R,G,B) 或数组(C,M,Y,K) 或数组(C,M,Y,K,SpotColorName)。默认值:默认颜色(空数组)。

    来源:http://www.tcpdf.org/doc/code/classTCPDF.html#a8fc7b86c255aeb0f14d281bdaeb2015c

    【讨论】:

      猜你喜欢
      • 2018-02-26
      • 1970-01-01
      • 2019-05-02
      • 1970-01-01
      • 1970-01-01
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多