0
votes

When creating a PDF in PHP (with TCPDF), I'm trying to position an image in the header, a small distance to the right of the left margin. However, the $x parameter is being completely ignored.

$img = file_get_contents('logo.png');
$pdf->Image('@'.$img,50,15,35,0,'PNG','','N',false,300,'L',false,false,0,false,false,false,false,[]);

The second parameter, 50, may as well be 0, 50 or 400: the image just won't move. If I change the 'L' for 'C', it goes to the middle of the page, but that's not what I want.

Am I missing something, or is it just a bug?

1

1 Answers

0
votes

You need to create a fitbox before, then it will respect the X placing.

$img =file_get_contents('logo.png');
$fitbox = 'LT';
$pdf->Image('@'.$img,50,15,35,0,'PNG','','N',false,300,'L',false,false,0,$fitbox,false,false,false,[]);