apulmca Posted January 29, 2009 Share Posted January 29, 2009 Hi All, I am using FPDF for generating PDF documents. All is fine except the images. All images have stretched. I have given this code for this $pdf->Image("PDFlogo.png"); Can anybody help me? Thanks Link to comment https://forums.phpfreaks.com/topic/142962-solved-pdf-generation-using-fpdf-library/ Share on other sites More sharing options...
ScotDiddle Posted January 29, 2009 Share Posted January 29, 2009 apulmca, You can use the optional parameters... See here: http://doc-typo3.ameos.com/3.7.0/classFPDF.html#c883bc75c65959ce84adaa102eb22da9 $sourceImage = 'images/MyJpg.jpg' $c1 = 20; $c2 = 40; $h = 172; $pdf->Image($sourceImage,$c1,$c2,$h); Scot L. Diddle, Richmond VA Link to comment https://forums.phpfreaks.com/topic/142962-solved-pdf-generation-using-fpdf-library/#findComment-749578 Share on other sites More sharing options...
apulmca Posted February 5, 2009 Author Share Posted February 5, 2009 Hi, I was doing it. but I saw that FPDF page unit was set to mm. And now I am passing width and height for image after converting into mm from PX. And all works fine. $pdf->Image($name,$x,$y,pxtomm($w),pxtomm($h)); Also, I am giving Pixel to MM conversion function: function pxtomm($px) { $mm = (int)floor($px/3.78); return $mm; } Hope it will help for someone finding the same. Thanks PHPOpenSource Link to comment https://forums.phpfreaks.com/topic/142962-solved-pdf-generation-using-fpdf-library/#findComment-755121 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.