开发者

FPDF image not displaying

开发者 https://www.devze.com 2023-02-16 01:18 出处:网络
I tried to put an image in my pdf document, bu开发者_开发问答t when I use that method it only loading for a while, and do nothing (no errors, or such things) only a grey site...

I tried to put an image in my pdf document, bu开发者_开发问答t when I use that method it only loading for a while, and do nothing (no errors, or such things) only a grey site...

$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('logo.png');
$pdf->Output();

So what I do wrong? If I only use text in the pdf, it's no problem, but with the Image. The Image is in the root-directory.

Edit: Added $pdf->AddPage(); as per the comment in Ewan Heming's answer.


Your example doesn't include a method call to add a page to the PDF before placing the image on it:

$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('logo.png');
$pdf->Output();


Sry guys i found out the problem , the resolution of the picture was too big

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号