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

spatie/pdf-to-image

View on GitHub

Description

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

Roles and Permissions in Laravel 13

14 lessons
57 min

Queues in Laravel 13

18 lessons
1 h 12 min read

How to Build Laravel 13 API From Scratch

30 lessons
1 h 23 min

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.