我已经在本地服务器(Windows)中使用了 tcpdf 条码并且条码出现了。在我将代码上传到 linux 服务器后,只有条形码没有出现。我正在使用 codeigniter 和 composer tcpdf本地截图截图linux服务器: 这是我在应用程序/库中的代码:<?php defined('BASEPATH') OR exit('No direct script access allowed');class Pdf extends TCPDF{ /** * PDF filename * @var String */ public function __construct(){ parent::__construct(); } public function Header() { // Logo $image_file = base_url().'assets/images/logo/logo-wide.png'; $this->Image($image_file, 10, 10, 50, '', 'PNG', '', 'T', false, 300, 'C', false, false, 0, false, false, false); } // Page footer public function Footer() { $image_file = base_url().'assets/images/email/footer_email.png'; $this->Image($image_file, 0, 278, 210, 20, "PNG", "", "T", false, 300, "", false, false, 0, false, false, false); // Position at 15 mm from bottom $this->SetY(0); // Set font $this->SetFont("dejavusans", "", 9); } public function setupTicket($pdfName,$data){ $this->SetCreator(PDF_CREATOR); $this->SetTitle($pdfName); $this->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $pdfName, PDF_HEADER_STRING); $this->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $this->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $this->SetDefaultMonospacedFont('helvetica'); $this->SetHeaderMargin(PDF_MARGIN_HEADER); $this->SetFooterMargin(PDF_MARGIN_FOOTER); $this->SetMargins(PDF_MARGIN_LEFT, 35, PDF_MARGIN_RIGHT); $this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $this->SetFont('helvetica', '', 9); $this->setFontSubsetting(false); $this->AddPage(); $style = array( 'border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0,0,0), 'bgcolor' => false, //array(255,255,255) 'module_width' => 1, // width of a single module in points 'module_height' => 1 // height of a single module in points ); }}
1 回答
繁花如伊
TA贡献2012条经验 获得超12个赞
我忘记更改我的 tcpdf 配置。如果您使用作曲家,请打开文件夹vendor/tecnickcom/tcpdf/config/tcpdf_config.php
。更改define('K_TCPDF_CALLS_IN_HTML', false);
为true
- 1 回答
- 0 关注
- 195 浏览
添加回答
举报
0/150
提交
取消