Convert html to pdf. all Chinese characters are question marks. solution:

Source: Internet
Author: User
Ask html to convert to pdf Chinese is all question mark solution html2fpdf convert simple html to pdf Chinese garbled characters I am not sure, changed to html2pdf
Vendor('html2).html 2pdf ');
$ Html2pdf = new HTML2PDF ('P', 'A4 ', 'Fr', true, 'utf-8', array (30, 20, 25, 25 ));
$ Html2pdf-> parsingCss-> fontSet ('javusans ');
$ Html2pdf-> WriteHTML ("

Come out, big brother.

This is a test ");
$ Html2pdf-> Output ("sample.pdf", 'I ');
Echo "PDF file is generated successfully! ";
The Chinese characters are all question marks.
You guys, how can we solve this problem? I can't help you.


Reply to discussion (solution)

What is your HTML2PDF version?
Vendor('html2).html 2pdf '); what framework is used, and plug-ins are not fixed for you. what is the purpose of this framework?

I didn't understand the specific version.
Define ('_ CLASS_HTML2PDF _', '4. 03 ');
Define ('html2pdf _ used_tc1__version ', '5. 0.002 ');
ThinkPHP framework used

What is your HTML2PDF version?
Vendor('html2).html 2pdf '); what framework is used, and plug-ins are not fixed for you. what is the purpose of this framework?

This is because you do not have the DejaVuSans font, and it is also a bit difficult to write.
You can refer to the example file examples/utf8.php provided by him.
And set style = "font-family: freeserif">
Change to style = "font-family: stsongdlight"

There are many online introductions on how to use other fonts.

Thank you very much. I have only been working for two months. The foundation is really bad.
Thank you for your guidance.

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.