Ask HTML to PDF Chinese is a question mark solution

Source: Internet
Author: User
Html2fpdf Simple HTML to PDF Chinese garbled I can't handle it, I changed it to Html2pdf.
Vendor (' html2pdf.html2pdf ');
$html 2pdf = new Html2pdf (' P ', ' A4 ', ' fr ', true, ' UTF-8 ', Array (30, 20, 25, 25));
$html 2pdf->parsingcss->fontset (' Dejavusans ');
$html 2pdf->writehtml ("

Come out, Big Brother.

This is a test ");
$html 2pdf->output ("Sample.pdf", ' I ');
echo "PDF file is generated successfully!";
The results come out Chinese characters are all question marks
You big God, how to solve AH really no need to ask God to help you I really have no way


Reply to discussion (solution)

What version of your html2pdf is it?
Vendor (' html2pdf.html2pdf '); What frame is used, and even if the plugin does not fix it for you, what is the use of this framework?

I don't understand the exact version, it should be in these two lines.
Define (' __class_html2pdf__ ', ' 4.03 ');
Define (' html2pdf_used_tcpdf_version ', ' 5.0.002 ');
thinkphp framework for the use of

What version of your html2pdf is it?
Vendor (' html2pdf.html2pdf '); What frame is used, and even if the plugin does not fix it for you, what is the use of this framework?

This is because you do not dejavusans this font, but also a bit of a problem with the wording
You can refer to the sample file he provided examples/utf8.php
and will style= "Font-family:freeserif" >
Change to style= "Font-family:stsongstdlight"

As for how to use other fonts, the online introduction of many

Thank you very much, I only took part in the work two months, the foundation is really poor
I really appreciate 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.