Christian Eric Paran
Christian Eric Paran

Reputation: 1010

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.

Upvotes: 0

Views: 18513

Answers (4)

Faizan
Faizan

Reputation: 1

Try $pdf->Image('..\Project_ITCPH\images.jpg', 1, 10, 5.8, 1.5); this is some time happen cause server could not find the folder path hope this work for u also try this

require('fpdf.php');

Upvotes: 0

Anagio
Anagio

Reputation: 3075

Check out this class it lets you add images to PDF's with PHP it has a lot of demo's

https://github.com/dompdf/dompdf

Upvotes: 0

kingmaple
kingmaple

Reputation: 4320

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.

Upvotes: 4

Mchl
Mchl

Reputation: 62395

Upgrade your FPDF to 1.7. It now supports alpha channel in PNGs.

Upvotes: 3

Related Questions