require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(); $pdf->AddPage(); // create a cell with text inside $pdf->Cell(50, 10, 'Hello World!', 1, 0, 'C'); $pdf->Output();
require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(); $pdf->AddPage(); // create an image cell $pdf->Image('image.jpg', 10, 10, 50, 50, '', '', '', true, 300, '', false, false, 0, false, false); $pdf->Output();In this example, we create a TCPDF object and add a page. Then we use the Image function to create a cell with an image inside. The first parameter is the image file path, the next two parameters are the x and y coordinates, the fourth and fifth parameters are the width and height of the cell, and the rest of the parameters are the image properties. Package Library: TCPDF