How can the extentImage method in Imagick be used to adjust the position of a graphic within a PDF document in PHP?

To adjust the position of a graphic within a PDF document using the extentImage method in Imagick, you can specify the desired width, height, x-offset, and y-offset of the graphic within the document. This method allows you to resize and reposition the image as needed.

// Load the PDF file
$pdf = new Imagick('input.pdf');

// Load the graphic file
$graphic = new Imagick('graphic.jpg');

// Resize and reposition the graphic within the PDF document
$graphic->extentImage(200, 200, 50, 50);

// Composite the graphic onto the PDF document
$pdf->compositeImage($graphic, Imagick::COMPOSITE_OVER, 0, 0);

// Save the modified PDF document
$pdf->writeImages('output.pdf', true);