TCPDF 徽标标题
我试图让我的徽标显示在标题中并居中。 我正在使用 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 文件下......
I'm trying to get my logo show up in the header and centered.
I'm using Cakephp and my logo file is kki.jpg which is saved under images folder of TCPDF folder, TCPDF is also saved in vendor folder and PDF is working fine and this is also defined in config like below:
define ('K_PATH_IMAGES', '/images/');
Below is my code:
$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);
I cannot get logo to show up in my header. Is there a reason why?
This is under view_pdf.ctp file by the way...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将此代码写入同一配置文件中。
Write this code in the same config file.
tcpdf 默认 url 是 xxx\examples\images ,所以你应该将 img 放入此 url 或设置
tcpdf default url is xxx\examples\images ,so you should put img into this url or set
在配置 tcpdf.php 文件中重写此代码
rewrite this code in config tcpdf.php files