Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何修复';TCPDF条码不显示';在linux服务器中?_Php_Codeigniter_Barcode_Tcpdf - Fatal编程技术网

Php 如何修复';TCPDF条码不显示';在linux服务器中?

Php 如何修复';TCPDF条码不显示';在linux服务器中?,php,codeigniter,barcode,tcpdf,Php,Codeigniter,Barcode,Tcpdf,我已经在本地服务器(windows)中使用了tcpdf条形码,并且出现了条形码。在我将代码上传到linux服务器后,只有条形码没有出现 我正在使用codeigniter和composer 本地截图: linux服务器屏幕截图: 这是我在应用程序/库中的代码: <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Pdf extends TCPDF{ /** * PDF filen

我已经在本地服务器(windows)中使用了tcpdf条形码,并且出现了条形码。在我将代码上传到linux服务器后,只有条形码没有出现

我正在使用codeigniter和composer

本地截图:

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
    );
    $params = $this->serializeTCPDFtagParameters(array($data['link_barcode'], 'QRCODE,H', 132, "", 25, 25, $style, 'N'));
    $htmlBarcode = '<tcpdf method="write2DBarcode" params="'.$params.'" />';

    $content = '
      <table cellpadding="4" >
       <tr>
        <td align="center" colspan="3" style="font-size:10px;border: 1px solid #e0e0e0;">
          <b>'.$data["ticket_name"].'</b>
          <br><br>'.$htmlBarcode.'
          <br>
          <b>'.$data["product_code"].'</b>
        </td>
       </tr>
      </table>';
    $this->writeHTML($content, true, false, true, false, '');
  }

  public function show_ticket($pdfName,$data){
    $this->setupTicket($pdfName,$data);
    $this->Output($pdfName.'.pdf', 'I');
  }
}

我忘了更改我的tcpdf配置。如果使用composer,请打开文件夹
vendor/tecnickcom/tcpdf/config/tcpdf\u config.php
。更改
define('K\u TCPDF\u调用\u IN\u HTML',false)到<代码>真