Why is TCPDF Image smaller than it should be?

Bobby Tables picture Bobby Tables · Nov 15, 2011 · Viewed 12.8k times · Source

I have a 842 x 595 PDF, 72 dpi and i'm inserting a 1200x800 image, again with 72dpi.

scaleFactor is 1, imageScale is 1

in theory, my pdf should show part of the image (the first 842px). In reality the ratio is wrong, i have white space to the right and bottom.

I'm upgrading from FPDF and if i switch back to that it shows the picture ok.

$pdf = new TCPDF($this->orientation, 'pt', $this->format, true, 'UTF-8', false);
$pdf->setMargins(0, 0, -1, 1);
$pdf->setJPEGQuality(90);
$pdf->setImageScale(1);

$pdf->Image($image->path,0,0,0,0,'','','T',false, 72,'',false,false,0,'LT');

The sizes and scales all look fine if i dump the $pdf object...

Am i missing something?

Answer

Bobby Tables picture Bobby Tables · Nov 16, 2011
$pdf->SetAutoPageBreak(false, 0);

If someone is having the same problem, this is how i solved it. I hate it when i find people with the same exact problem i have and don't get back with the answer after they solved it.