Fpdf class for generating PDF documents using PHP

Source: Internet
Author: User
In earlier versions of PhP4, it was relatively easy to use pdflib to generate PDF files. Now we have upgraded to PhP5 and found that it is more troublesome. The installed PHP 5.2.4 does not have phplib by default. We found one on php.net, after installation, I always reported an error. I thought it was a version compatibility problem. Later I went to the rented server (PhP 4.3.11) and I couldn't. I searched online and found that phplib was not free of charge, forget it. Give up!
Continue to search for other solutions. phpMyAdmin uses the PDF generation function tcpdf. The test shows that Chinese characters are not supported and all Chinese characters are displayed as square characters, if you have initially determined that smoking cessation is a font problem and there is no proper solution on the Internet, you have to give up again!
Finally, I found a simple, practical, and Chinese file named fpdf. It runs normally on PHP 5.2.4 and PHP 4.3.11 and completely meets your requirements for smoking cessation ~~ It's you!

Download: http://www.fpdf.org/
Chinese Pack: http://www.fpdf.org/download/chinese.zip
Chinese manual: http://www.fpdf.org/en/dl.php? Id = 72 
You can also download the fpdf from the attachment in this article and provide two versions, 1.5.2 and 1.5.3. However, the Chinese version of the manual is only 1.5.2, and the description is full, basic instructions are available.

Decompress Chinese. php and Ex. php In the Chinese package to the downloaded fpdf package, and run ex. php to see what is displayed in Traditional Chinese.

Set the followingCode:
$ PDF-> addbig5font ();
$ PDF-> setfont ('big5', '', 20 );
Replace:
$ PDF-> addgbfont ();
$ PDF-> setfont ('gb', '', 20 );

Then, replace * of $ PDF-> write (5, '*'); with the Chinese text you want to output. Everything is OK! Run ex. php again?


Attachment: F00001.5.2.zip (189.77 K, downloads: 189)

Attachment: F00001.5.3.zip (191.2 K, downloads: 124)

Attachment: Chinese.zip (3.65 K, downloads: 18)

Attachment: F00001.5.2chinese album .zip (35.43 K, downloads: 32)

Reprinted: http://hi.baidu.com/ericden/blog/item/c4983873d01baf198601b02e.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.