pdf2image is a Python library that acts as a wrapper around the command-line utilities `pdftoppm` and `pdftocairo` (parts of the Poppler PDF rendering library) to convert PDF documents into a list of PIL Image objects. It provides a convenient Pythonic interface for tasks like document display, data processing, and creating thumbnails. The current version is 1.17.0, and it maintains an active release cadence.
pip install pdf2imageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates converting a PDF file into a list of PIL Image objects using `convert_from_path` and saving each page as a JPEG image. It highlights the use of `output_folder` for efficiency with large PDFs and `fmt` for specifying the output image format. Users must ensure Poppler is installed and correctly configured in their system's PATH for the library to function.
Install Poppler for your operating system (e.g., `sudo apt-get install poppler-utils` on Ubuntu, `brew install poppler` on macOS, or download binaries for Windows and add to PATH). For Windows, consider passing `poppler_path='C:\path\to\poppler\bin'` to `convert_from_path`.
Always use the `output_folder` parameter when converting large PDFs: `images = convert_from_path('large.pdf', output_folder=temp_dir_path)`.Upgrade to version 1.13.1 or later. The issue was fixed in 1.13.1.
Do not use version 1.12.0. If you encounter this, upgrade to a later stable version (e.g., 1.12.1 or higher).
Ensure your system's Poppler installation is up-to-date. Regularly check for and apply updates to Poppler utilities.
Ensure you have the correct Python environment activated and install the package using `pip install pdf2image`. If using a virtual environment, activate it first.
Install Poppler utilities on your operating system. For Windows, download pre-compiled binaries and add the `bin/` folder to your system's PATH or explicitly pass `poppler_path` to `convert_from_path`. For macOS, use `brew install poppler`. For Debian/Ubuntu, use `sudo apt-get install poppler-utils`.
First, ensure Poppler is up-to-date; if not, update it (e.g., `brew upgrade poppler` or reinstall `poppler-utils`). If the issue persists with a valid PDF, the file itself might be problematic. You can try opening it in a PDF viewer to confirm its integrity.