cannot install pdftotext on windows because of poppler

Viewed 6722

I am trying to install pdftotext on windows:

pip install pdftotext

It failed originally because of lack of MS visual studio (now installed) and now it fails with a poppler problem. I have downloaded poppler and it is installed in

C:\Program Files (x86)\poppler

my path includes this directory.

The install fails with an error screen image of error

I cannot find the file poppler-cpp.lib in Program Files (x86)

I know that installing poppler is problematic and there are many questions on the web relating to it and one seems to be my problem exactly (mark on 19 July 2018), but no solution seems to have been offered. I have it installed on linux and it works like a dream. But, I need to have working on Windows too.

Can someone please help me to sort this out?

[EDIT 2018.09.17 I have found a reference to it here:

... The problem was that this binaries files were dynamic and, from the files with .lib extension (poppler.lib, poppler-cpp.lib, poppler-qt4.lib), only poppler.lib was a static library. Due to this, and using the cMake files content in the download of the source code of poppler I tried to generate static versions from all the dependencies of poppler, which was an easy thing to do ...

Does this help someone to come to my aid?

3 Answers

I struggled with exactly the same and wasn't able to compile a solution.

A workaround I'm using is running pdftotext.exe which is installed with miktex 2.9 (I'm already using this for latex).

Identify the path to pdftotext.exe after installing miktex. Then you can run it with the subprocess module.

Import subprocess
Subprocess.call([path/pdftotext.exe, 
options, file.pdf])

Switch options with the option you need.

Download the python-poppler release from https://github.com/cbrunet/python-poppler/releases/ and add it to the path. Restart the terminal.

I had similar problems installing python-poppler, which provides poppler functionality directly in python. Finally the solution worked, which was provided by avdosev on this issue.

I installed Visual Studio first but don't know if it was necessary in the end.

conda create -n poppler_env python
conda activate poppler_env
conda install -c conda-forge poppler
conda install cmake
conda install -c conda-forge pkg-config
pip install python-poppler

Note that the environment was crucial to making this work.

While this provides other functionalities than requested, it might help in installing pdftotext.

Related