3

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?

Psionman
  • 3,084
  • 1
  • 32
  • 65
  • This answer worked for me. [enter link description here](https://stackoverflow.com/a/46906992/4730933) – Konstantinos May 16 '19 at 15:07
  • Follow the steps mentioned on this [link](https://coder.haus/2019/09/27/installing-pdftotext-through-pip-on-windows-10/), it worked for me. The author has also posted an answer here: https://stackoverflow.com/a/58139729/326835 – Harshad Vyawahare Oct 14 '19 at 11:56
  • I recently encountered similar issues with Poppler. So, I wrote an article on how-to resolve them. The answer is Windows Subsystem for Linux. The article can be found here: https://medium.com/@matthew_earl_miller/poppler-on-windows-179af0e50150 – Matthew E. Miller Jan 09 '20 at 20:21
  • 1
    @MatthewE.Miller Thanks. I'd quite forgotten about this. In the end I dumped pdftotext in favour of PyPDF4 which gives me what I wanted – Psionman Jan 10 '20 at 12:20
  • Does this answer your question? [Unable to install pdftotext on Python 3.6, missing poppler](https://stackoverflow.com/questions/45912641/unable-to-install-pdftotext-on-python-3-6-missing-poppler) – Vikash Gupta May 02 '20 at 03:33
  • Prebuilt binaries with dependencies here: https://github.com/oschwartz10612/poppler-windows – Owen Schwartz Jun 27 '20 at 22:02

3 Answers3

0

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.

Cobse
  • 73
  • 11
  • Thanks for this insight. I'm working on a similar work around. I too use LaTeX, but I want the app to be distributable. I don't use M$ Windows much. Is mikTex part of the standard distribution? – Psionman Jan 06 '19 at 16:05
  • Miktex isn't standard on windows but a common latex distribution. It's free and easy to install. Quite big though. – Cobse Jan 06 '19 at 16:08
0

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

0

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.

Caah Arch
  • 63
  • 7