HTML2pdf converts html into html and the image is lost.

Source: Internet
Author: User
HTML2pdf: convert html into html.

The converted pdf file does not exist.

I use regular expressions to replace the image and insert it into the image.
$ Pattern = "// I ";
Preg_match_all ($ pattern, $ file, $ match );
Var_dump ($ match );
For ($ I = 0; $ I $ Img_url = preg_match ("/^ http: \\//", $ match [1] [$ I])? $ Match [1] [$ I]: "http://file.aconf.org". $ match [1] [$ I];
Preg_replace ($ match [0] [$ I], $ pdf-> Image ($ img_url, 5, 5,200,150, $ type = '', $ link = "", $ paint = true), $ file );
}
$ Pdf-> Image ($ img_url, 5, 5,200,150, $ type = '', $ link =" ", $ paint = true );
Error

Please give me some advice.


Reply to discussion (solution)

Make sure your image format is accepted (JPEG, PNG)
Make sure that the remote image can be read using the file function (if the recipient has anti-Leech protection, the image cannot be read)

The image is jpg and can be read for sure.

Vendor('html2fpdf.html 2fpdf ');
$ Pdf = new FPDF ();
$ Pdf-> AddPage ();
$ Pdf-> SetFont ('arial', 'B', 16 );
$ Pdf-> Cell (, 'Hello World! ');
$ Pdf-> Image ('http: // file.aconf.org/public/images/logo.png', 'png ');
$ Pdf-> Output ();
Error Alpha channel not supported: http://file.aconf.org/public/images/logo.png directly using the picture insertion function

The following png mode is not supported
Interlacing)
Alpha channel

Thank you. I changed the image.

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.