Home > Codeigniter, PHP > Codeigniter pdf libraries (php export pdf Unicode/UTF8 – Vietnamese)

Codeigniter pdf libraries (php export pdf Unicode/UTF8 – Vietnamese)

Thêm mPDF libraries cho Codeigniter Framework, xuất file pdf Tiếng Việt có dấu (pdf Unicode/utf8)

Step 1:  Download mPDF tại địa chỉ URL: http://www.mpdf1.com/mpdf/download

Step 2:  Giải nén (uncompress) thư viện mPDF vào thư  mục libraries của Codeigniter như  sau:
your_project/system/application/libraries/mpdf/ (uncompress mpdf)

Step 3: Tạo file để gọi các lớp trong thư viện mpdf như  sau:


Sau đó lưu (Save) tại đường dẫn sau:
your_project/system/application/libraries/Mpdf.php
Step 4: Sử dụng

$html = "Cho ví dụ minh họa";
$this->load->library('Mpdf');
$mpdf = new Pdf();
$mpdf->useAdobeCJK = true;
$mpdf->SetAutoFont(AUTOFONT_ALL);
$mpdf->WriteHTML($html);
$save_file = $dir_bill.$filename.'.pdf';
$mpdf->Output(); //Neu xuat ra file $mpdf->Output('dir/ten_file_pdf', 'F');


nhantam
PHP Developer
Chuyên Thiết kế web bán hàng

Advertisements
  1. rafael
    24/08/2012 at 03:28

    I tried the version 2.0 codeigniter, MPDF 5.4, this example does not work

    • 24/08/2012 at 17:38

      @rafael…I have test on codeignier version 1.7.2. Could you tell me error when you test version 2.0 ?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: