0

Now I'm doing a task about exporting data into PDF from CodeIgniter framework. I'm using FPDF http://www.fpdf.org/ for exporting the PDF. And here is my controller:

public function exportPDF()
{
    $pdf = new FPDF('l','mm','A4');
    // create new page
    $pdf->AddPage();
    // setting font type
    $pdf->SetFont('Arial','B',8);

    $pdf->Cell(40,6,'オーダー番号',1,0);
    $pdf->Cell(35,6,'デリバリー日',1,0);
    $pdf->Cell(30,6,'カスタマー名',1,0);
    $pdf->Cell(60,6,'住所',1,0); 
    $pdf->Cell(12,6,'数量',1,1);

    $pdf->SetFont('Arial','',8);

    //fetch data
    $res['data'] = $this->session->userdata('logistic_account');
    $data['orderlist'] = $this->Bll_products->exportPDF($res['data']['logistic_id']);

    foreach ($data['orderlist'] as $row) {
        $pdf->Cell(40,6,$row->order_number,1,0);
        $pdf->Cell(35,6,$row->delivery_date,1,0);
        $pdf->Cell(30,6,$row->name,1,0);
        $pdf->Cell(60,6,$row->address,1,0); 
        $pdf->Cell(12,6,$row->order_quantity,1,1);
    }

    $filename = $res['data']['pic_name']."_".date("Y-m-d H:i:s").'.pdf';
    $pdf->Output($filename, 'D');

}

But the result like this:

enter image description here

How do I can display a Japanese word in that .pdf file?

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
tjandra
  • 85
  • 1
  • 2
  • 7
  • I believe this can help you. Take a look at this answer https://stackoverflow.com/a/27398045/5721944 – Donlee Malacad Dec 07 '18 at 06:56
  • It is very easy and quite possible! tFPDF allows you to use UTF-8 in PDF's, take a look at my answer here: https://stackoverflow.com/a/56429391/2430549 – HoldOffHunger Jun 04 '19 at 16:20

0 Answers0