qmetrics.net

PDF to Image

PHP class for PDF to image conversion

This Composer package converts PDF pages to images using Imagick and Ghostscript, including multi-page export and optional encrypted PDF support.

Overview

spatie/pdf-to-image offers a PHP class that turns PDF documents into one or more image files. It is intended for PHP applications that need raster output from PDFs without building a custom Imagick pipeline. The package requires PHP 8.2 or newer and expects Imagick and Ghostscript to be available on the host.

You can save individual pages or all pages into an existing directory, adjust Imagick merge layer behavior, set output background color, and on ImageMagick 7 pass passwords for encrypted PDFs with explicit exceptions when passwords use unsupported characters or when the runtime cannot apply passwords. Helpers report which password characters are allowed on the current platform.

Conversion goes through Ghostscript inside Imagick. CLI PHP often finds Ghostscript on PATH, while PHP-FPM may need environment configuration so the gs binary is visible to the web process. Large or ultra-wide PDFs may require policy.xml width and height limit changes. Security policy errors for PDF operations are documented with policy.xml edits.

Install via Composer. The library is suited to scripted or application-side batch conversion rather than an end-user desktop tool.

Key features

  • Single or multi-page PDF export
  • Imagick merge layer control
  • Output background color
  • Encrypted PDF passwords on IM7
  • Password character validation
  • Ghostscript via Imagick
  • Ultra-wide PDF policy notes
  • Composer installation

Use cases

  • Server-side PDF thumbnails
  • Laravel job PDF rasterization
  • Batch page image export
  • Protected PDF conversion

Tags

Similar software

Stirling PDF

Self-hostable open-source PDF editing platform

An open-source PDF platform for editing, signing, converting, and automating documents in the browser, on desktop, or on your own servers with a private API.

★ 97.6k⟳ todayMIT · open core
Open Source Alternative to:Adobe AcrobatFoxit PDF Editor

MinerU

Document parser for Markdown and structured agent output

MinerU converts PDFs, images, and office documents into Markdown and structured JSON for apps, agents, and local workflows.

★ 84.4k⟳ 10 days agoApache-2.0

Paperless-ngx

Community-supported document management system for archiving scanned documents

Paperless-ngx turns physical documents into a searchable online archive. It is deployed with Docker Compose and is the official successor to Paperless and Paperless-ng.

★ 48.7k⟳ yesterdayGPL-3.0

Marker

Document to markdown and JSON conversion toolkit

Marker converts PDFs, images, and Office files into markdown, JSON, chunks, or HTML with layout, tables, math, and optional LLM-assisted cleanup. It runs on GPU, CPU, or Apple MPS via CLI modes.

★ 41.1k⟳ 8 days agoApache-2.0

OCRmyPDF

Command-line OCR text layer for scanned PDFs

OCRmyPDF adds a searchable text layer under scanned PDF images using Tesseract, keeping layout friendly for copy and paste while optimizing file size.

★ 35.4k⟳ yesterdayMPL-2.0

jsPDF

Client-side JavaScript library for generating PDF documents

jsPDF builds PDF files in the browser or in Node.js without a server round trip. It supports pages, fonts, UTF-8 via custom fonts, and optional HTML rendering.

★ 31.3k⟳ 2 months agoMIT