Skip to main content
Back to packages
1,456 GitHub stars

spatie/pdf-to-image

View on GitHub

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

Marketing for Developers in 2026

7 lessons
52 min

Testing in Laravel 13 For Beginners

26 lessons
1 h 41 min read

Laravel 13 Eloquent: Expert Level

41 lessons
1 h 34 min