{"library":"pdf2image","title":"pdf2image Library","description":"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.","status":"active","version":"1.17.0","language":"en","source_language":"en","source_url":"https://github.com/Belval/pdf2image","tags":["PDF","image conversion","PIL","Poppler"],"install":[{"cmd":"pip install pdf2image","lang":"bash","label":"Install pdf2image Python package"}],"dependencies":[{"reason":"pdf2image is a wrapper around these command-line utilities and requires them to be installed and accessible in the system's PATH. Without Poppler, pdf2image cannot function.","package":"Poppler (pdftoppm, pdftocairo)","optional":false},{"reason":"Required for handling and manipulating the generated image objects.","package":"Pillow (PIL Fork)","optional":false}],"imports":[{"symbol":"convert_from_path","correct":"from pdf2image import convert_from_path"},{"symbol":"convert_from_bytes","correct":"from pdf2image import convert_from_bytes"}],"quickstart":{"code":"import os\nimport tempfile\nfrom pdf2image import convert_from_path\n\n# NOTE: For this code to run, you need Poppler installed and in your PATH.\n# Create a dummy PDF file for the example (replace with your actual PDF path)\n# This example assumes 'dummy.pdf' exists in the same directory.\n# In a real scenario, you'd provide the path to an existing PDF.\nif not os.path.exists('dummy.pdf'):\n    print(\"Please create a 'dummy.pdf' file in the current directory or provide a valid path.\")\n    # Example: Create a simple dummy PDF using a library like ReportLab or manually\n    # For demonstration, we'll simulate a successful conversion if no PDF exists\n    # by skipping the actual conversion and printing a message.\n    # In a real app, you'd handle this error.\nelse:\n    try:\n        with tempfile.TemporaryDirectory() as path:\n            images = convert_from_path(\n                'dummy.pdf', \n                output_folder=path, \n                fmt='jpeg', \n                dpi=200\n            )\n\n            for i, image in enumerate(images):\n                output_filename = f\"output_page_{i+1}.jpeg\"\n                image.save(output_filename, 'JPEG')\n                print(f\"Saved {output_filename}\")\n        print(\"PDF conversion successful (if 'dummy.pdf' existed and Poppler was configured).\")\n    except Exception as e:\n        print(f\"An error occurred during PDF conversion: {e}\")\n        print(\"Please ensure Poppler is installed and its 'bin' directory is in your system's PATH.\")\n        print(\"For Windows, you might need to specify poppler_path=r'C:\\path\\to\\poppler\\bin' in convert_from_path.\")","lang":"python","description":"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."},"warnings":[{"fix":"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`.","message":"pdf2image is a wrapper and **requires Poppler command-line utilities** (`pdftoppm` and `pdftocairo`) to be installed on your system. If Poppler is not installed or its `bin` directory is not in your system's PATH, you will encounter `PDFInfoNotInstalledError` or similar issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use the `output_folder` parameter when converting large PDFs: `images = convert_from_path('large.pdf', output_folder=temp_dir_path)`.","message":"Converting large PDF files without specifying an `output_folder` can lead to excessive memory consumption, potentially causing the process to be killed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to version 1.13.1 or later. The issue was fixed in 1.13.1.","message":"Version 1.13.0 was explicitly deprecated shortly after its release due to an issue with `convert_from_bytes` not respecting the `use_pdftocairo` parameter.","severity":"deprecated","affected_versions":"1.13.0"},{"fix":"Do not use version 1.12.0. If you encounter this, upgrade to a later stable version (e.g., 1.12.1 or higher).","message":"Version 1.12.0 introduced a deadlock on Windows when using `convert_from_path` with multiple threads and was subsequently removed from PyPI.","severity":"breaking","affected_versions":"1.12.0"},{"fix":"Ensure your system's Poppler installation is up-to-date. Regularly check for and apply updates to Poppler utilities.","message":"Using outdated versions of Poppler can lead to `PDFPageCountError`, `Syntax Error`, or other unexpected issues when processing certain PDFs.","severity":"gotcha","affected_versions":"All versions (when used with old Poppler)"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}