Html2pdf HTML into PDF HTML inside lost image

Source: Internet
Author: User
There are pictures in HTML

The converted PDF has no

And I used the regular to replace the picture inside and then insert the picture.
$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, Max, max, $type = ", $link =" ", $paint =true), $file);
}
$pdf->image ($img _url, 5, 5, $, =true, $type = ", $link =" "," $paint ");
Error occurred

Ask the great God for guidance.


Reply to discussion (solution)

Confirm that your image format can be accepted (JPEG, PNG)
Confirm that the remote picture can be read by the file function (if the other party has a chain of anti-theft, not enrolled)

The picture is JPG can be read to be sure

Vendor (' html2fpdf.html2fpdf ');
$pdf = new FPDF ();
$pdf->addpage ();
$pdf->setfont (' Arial ', ' B ', 16);
$pdf->cell (40,10, ' Hello world! ');
$pdf->image (' http://file.aconf.org/public/images/logo.png ', 60,30,90,0, ' png ');
$pdf->output ();
I directly use the Insert Image function Error alpha channel not supported:http://file.aconf.org/public/images/logo.png

The following modes are not supported for PNG
interlacing (Interleaved type)
Alpha Channel

Thank you so much for the fact that I changed a picture.

  • Related Article

    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.