0
votes

I am creating dynamic pdf files with tcpdf,fpdi,fpdf .The template pdf file is done in indesign and i wanted to use the x and y coordinates as a guide. (In design settings are in px). but when i put a picture

$pdf->Image($pic1, 10, 10,  100,  100,  'JPG', '', '', true, 300, '', false, false, 0, false, false, false);

the result image dimensions become like 280px X 280px . how can i stop tcpdf resizing my images? the same problem is for coordinates too. if i set up x and y coordinates to 100, the result is 280px too.

my tcpdf settings are in mm, i have tried different dpi settings too.

2

2 Answers

1
votes

In your constructor, you can set which units FPDF uses. By default, FPDF uses millimeters, not pixels. As such, when you write 100 by 100, you are actually telling it to print that image at 100mm by 100mm, not 100px by 100px.

If you change the constructor to use pixels, you may end up having to modify the positioning of the rest of your document if you do this, depending on how you handled your coordinates.

$pdf = new FPDF('P','pt');
1
votes

Millimeters are wrong too. I printed a 90 x 10mm rect to an A4 Page and it has is something around 9.6 cm. (FPDI Version 1.6)