PHP / TCPDF library - image size in PDF up to a certain number of inches?

Does anyone know how to get TCPDF to output a .GIF file with a specific number of inches of width x height?

I am trying to get a GIF embedded in a PDF so that it prints exactly 4x6 inches. I tried this:

$this->setpageUnit('in');
$this->Image($tmp, 0, 0, 4, 6, 'gif', '', '', true);

But it only seemed a blank page. Any ideas?

+3
source share
2 answers

I think this is because you are not using capital "P"

$this->setpageUnit('in');

perhaps it should be:

$this->setpageUnit('in');
+3
source

I think you need to figure out how many pixels per inch, and then use the method setImageScale(float $scale);

For example:

$this->setImageScale(24.5);

Then your code should work after setting the scale:

$this->Image($tmp, 0, 0, 4, 6, 'gif', '', '', true);
+1
source

Source: https://habr.com/ru/post/1716216/


All Articles