【问题标题】:TCPDF logo headerTCPDF 徽标标题
【发布时间】:2011-08-27 11:59:52
【问题描述】:

我正在尝试让我的徽标显示在标题中并居中。 我正在使用 Cakephp,我的徽标文件是 kki.jpg,它保存在 TCPDF 文件夹的 images 文件夹下,TCPDF 也保存在供应商文件夹中,PDF 工作正常,这也在下面的配置中定义:

define ('K_PATH_IMAGES', '/images/');

下面是我的代码:

$tcpdf->SetAuthor("Likeslomakkeet");
$tcpdf->SetAutoPageBreak( true, $footerHeight );
//$tcpdf->SetTopMargin(10);
$tcpdf->setHeaderFont(array($textfont,'',30));
//$tcpdf->SetMargins(20, 30);
$tcpdf->SetHeaderData("kki.jpg", PDF_HEADER_LOGO_WIDTH, "Application PDF", "Likeslomakkeet - www.likeslomakkeet.net");
$tcpdf->xheadercolor = array(238,238,238);
$tcpdf->xheadertext = '';
$tcpdf->xfootertext = 'Copyright © %d Likeslomakkeet. All rights reserved.';
$tcpdf->AddPage();
$tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($textfont,'',14);

我无法在标题中显示徽标。有什么原因吗?

这是在view_pdf.ctp文件下...

【问题讨论】:

  • 您是否收到任何类型的错误消息?图像是否是某种奇怪的、更不寻常的 jpeg 格式(例如,用 PNG 图像进行测试?)
  • 我确实用 png 图像对其进行了测试,但它不起作用......奇怪吧?

标签: php cakephp pdf tcpdf


【解决方案1】:

将此代码写入同一个配置文件中。

define ('PDF_HEADER_LOGO', 'kki.jpg');

【讨论】:

    【解决方案2】:

    tcpdf 默认 url 是 xxx\examples\images ,所以你应该把 img 放到这个 url 或者设置

    【讨论】:

      【解决方案3】:
      /**
       * Deafult image logo used be the default Header() method.
       * Please set here your own logo or an empty string to disable it.
       */
      define ('PDF_HEADER_LOGO', '');
      

      在配置 tcpdf.php 文件中重写此代码

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-12-04
        • 2013-03-28
        • 2021-06-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多