TCPDF期望参数2是字符串,给定对象

时间:2016-10-28 03:57:14

标签: php tcpdf codeigniter-3

美好的一天,我正在尝试用 TCPDF 创建PDF但是我收到了一个错误。

这是我的剧本

function print_do($kode) 
{
        $this->load->library('Pdf');
        $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $obj_pdf->SetCreator(PDF_CREATOR);
        $title = "PDF Report";
        $obj_pdf->SetTitle($title);
        $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
        $obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $obj_pdf->SetDefaultMonospacedFont('helvetica');
        $obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $obj_pdf->SetFont('helvetica', '', 9);
        $obj_pdf->setFontSubsetting(false);
        $obj_pdf->AddPage();
        $data=array();
        $data['header']             = $this->modelmodel->showsingle("select * from deliveryorder where TransactionNo = '".$kode."' ");
        $rslt                       = $data['header'];
        $data['detail']             = $this->modelmodel->showdata("select a.*,b.ItemName from DeliveryOrderDetail a 
                                                                    left join item b on a.ItemCode = b.ItemCode
                                                                    where DeliveryOrderTransNo = '".$rslt->TransactionNo."' ");
        $data['Title']              = "Do Mutasi";
        $data['Title_Description']  = "Form Input Do Mutasi";
        $data['type']               = $this->db->query("SELECT * FROM DeliveryOrderCategory")->result();
        $data['outlet']             = $this->modelmodel->showsingle("select OutletCode from 
                                                                    employee where nip = '".$this->input->cookie('cookie_posweb_user')."' ");
        $data['tipeitem']           = $this->modelmodel->showsingle("select TOP 1 ItemType from DeliveryOrderDetail a 
                                                                    left join Item b on a.ItemCode = b.ItemCode
                                                                    where DeliveryOrderTransNo = '".$rslt->TransactionNo."'");
        $content = $this->load->view('do_mutasi/print_view',$data);
        $obj_pdf->writeHTML($content, true, false, true, false, '');

        $obj_pdf->Output($kode, 'S');
}

我遇到了多个错误。

  • preg_match_all()期望参数2为字符串,对象为
  • 类CI_Loader的对象无法转换为字符串

然后在页面的末尾(错误之后)。我的观点出现了。我不能说得好或用英文写得很好。所以我认为这是我最好的解释。

enter image description here

我正在尝试改变

$obj_pdf->Output($kode, 'S');

$obj_pdf->Output($kode, 'I');

我在页面末尾的观点丢失了。

0 个答案:

没有答案