Description
Convert a pdf to an image
Converting a PDF to an image is easy.
$pdf = new \Spatie\PdfToImage\Pdf($pathToPdf);$pdf->save($pathToWhereImageShouldBeStored);
If the filename you pass to saveImage has the extensions jpg, jpeg, png, or webp the image will be saved in that format; otherwise the output format will be jpg.
The save() method returns an array with the filenames of the saved images if multiple images are saved, otherwise returns a string with the path to the saved image.
Recent Courses on Laravel Daily
Practical Laravel Security: Packages, Secrets, Supply-Chain Attacks
7 lessons
43 min read
AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)
7 lessons
52 min
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min