// Instantiate TCPDF object $pdf = new TCPDF(); // Add a page $pdf->AddPage(); // Set image scale factor $pdf->setImageScale(0.5); // Add local image file $file = 'path/to/image.png'; $pdf->Image($file); // Output PDF document $pdf->Output();
// Instantiate TCPDF object $pdf = new TCPDF(); // Add a page $pdf->AddPage(); // Set image scale factor $pdf->setImageScale(1.5); // Add image URL $url = 'https://example.com/image.jpg'; $pdf->Image($url); // Output PDF document $pdf->Output();In both examples, the setImageScale function is used to define the scaling factor for the image that will be included in the PDF document. The first example uses a local file path as the image source, while the second example uses an image URL. Package Library: TCPDF.