DEV Community

Mintu Agarwal
Mintu Agarwal

Posted on

Installation Guide for pdf2image for python

Recently for my Python project, I wanted to create images of the generated PDF from my script. I added an option to whether I want to create the images and used pdf2image.convert_from_path to create jpeg files for the same.

However, the installation of pdf2image isn't your usual pip3 install pdf2image. It would rather throw an error like this -

The headers or library files could not be found for jpeg,
  a required dependency when compiling Pillow from source.
Enter fullscreen mode Exit fullscreen mode

So first install some dependencies into your system using and then execute you pip3 install command

sudo apt-get install libjpeg-dev zlib1g-dev
pip3 install pdf2image
Enter fullscreen mode Exit fullscreen mode

Also

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay