probably this has already been asked before but I can't get it working. I'm trying to use TCPDF to generate a PDF document which should have a rectangle of 10 pixels at the coordinates (0, 0). The code is the following:
$pdf = new TCPDF();
$pdf->AddPage();
$pdf->SetFillColor(0, 0, 0);
$pdf->Cell(0, 2.645833333, '', 0, 1, '', true);
The rectangle is printed, but it has the wrong height in pixels. Default values for the TCPDF is to use the mm unit. I converted 10 pixels to mm using the website unitconversion.org. How can I fix the problem?
PDF's don't have pixels. They have points, how many, that depends on DPI (dots per inch). If you assume one point = one pixel, you can go from there and convert 10 points through 72 DPI (the default) to milimeters.
Its worth checking in tcpdf_config.php and the PDF_UNIT
which can be one of [pt=point, mm=millimeter, cm=centimeter, in=inch]