// Load the PDF file $pdf = new FPDI(); // Add a page $pdf->AddPage(); // Set the source file path $imagePath = 'path/to/image.png'; // Set the image position $x = 10; $y = 10; // Set the image size $width = 100; $height = 100; // Embed the image into the PDF document $pdf->Image($imagePath, $x, $y, $width, $height); // Output the PDF document $pdf->Output();
// Create a new PDF file $pdf = new FPDF(); // Add a page $pdf->AddPage(); // Set the image source file path $imagePath = 'path/to/image.png'; // Set the image position $x = 10; $y = 10; // Set the image size $width = 100; $height = 100; // Embed the image into the PDF document $pdf->Image($imagePath, $x, $y, $width, $height); // Output the PDF document $pdf->Output();PHP PDF Image is part of the TCPDF library, which is an open-source PHP class for generating PDF documents. The library is actively maintained and has a large user community. It can be easily installed using Composer.