Search code examples
phpfpdf

How to insert Image in pdf using PHP (Generating a PDF)?


I want to generate a PDF that will contain an image.

so i already tried this line of codes:

$pdf->Image('b.png',10,8,33);

the other is:

$pdf->Image('Project_ITCPH\images.jpg', 1, 10, 5.8, 1.5);

the problem here is this Error:

"Deprecated: Function set_magic_quotes_runtime() is deprecated in C:\xampp\htdocs\Project_ITCPH\reports\fpdf.php on line 931 FPDF error: Alpha channel not supported: b.png"

is there a problem with the fpdf.php? i only use it as include.

You have my regards.


Solution

  • This error simply means that FPDF is using a function call that is deprecated and outdated. This is shown because your PHP displays errors and warnings and deprecation notes. You should try turning off errors before generating the PDF or writing @ before function calls (like here) when using FPDF.

    By the way, I highly recommend you use mPDF for PDF generation with PDF, it's better supported in my opinion.