Why is TCPDF Image smaller than it should be?
13,885
$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.
Author by
Bobby Tables
Updated on June 15, 2022Comments
-
Bobby Tables almost 2 years
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?
-
mixable over 6 yearsThat's it... didn't find a solution for hours. Thank you!
-
Constantin Beer over 4 yearsCould you please format your answer, so what you are suggesting to do is more clear to see.
-
Eduardo Rivera Digital over 4 yearsthe original question was about TCPDF Image smaller than it should be? so my problem was the same, i fix all the code seting a new format of a page in TCPDF, but my print was in a diferent size... so i find other solution, setting the configuration of the pdf print devices in windows system...
-
Andre Van Zuydam over 2 yearsThank you so much, not sure why page breaks were messing with image sizing, very obscure fix!