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.