I just download poppler to Linux system,and I want to incorporate it in my app to parse pdf file.
(My goal is to convert pdf file to plain text.)
How can I do this?
-
1What did you try? What form of "poppler" did you download? Have you read the release and installing notices? – Basile Starynkevitch Jan 17 '12 at 06:02
-
actually all I need is "pdftotext" – zxi Jan 17 '12 at 06:07
-
1`apt-cache search pdftotext` suggests to install the `poppler-utils` package on my Debian system. But then you are *not* incorporating it into your application. IMHO, *incorporating* a library inside your software means calling that library, and linking with it. – Basile Starynkevitch Jan 17 '12 at 06:13
-
Many thanks for your help! I want to build a shared library with the same ability of "pdftotext" from the poppler code. – zxi Jan 17 '12 at 06:28
-
1Do not build software from source if a package for your OS exists. If you need to use a library in your software, install developer's version of the library (on Ubuntu that would be libpoppler-dev). – n. m. could be an AI Jan 17 '12 at 06:28
-
OK! But How Can I get the lib and relative manual? – zxi Jan 17 '12 at 06:32
-
1You need to install relevant packages. On Debian or Ubuntu, probably with `apt-get install libpoppler-dev` – Basile Starynkevitch Jan 17 '12 at 06:44
3 Answers
Poppler's git tree includes a useless INSTALL
doc that just tells you to run ./configure
, but they don't include automake/autoconf auto-generated files (including configure) in git. (Probably they do include them in tarball source releases.)
I just built poppler from git source (on Ubuntu 15.04) like so:
git clone --depth 50 --no-single-branch git://git.freedesktop.org/git/poppler/poppler
cmake -G 'Unix Makefiles' # other -G options are to generate project files for various IDEs
# look at the output. If it didn't find some libraries,
# install them with your package manager and re-run cmake
make -j4
# optionally:
sudo make install
It appears that they maintain an autoconf/automake build setup, so you can use that OR cmake to create a Makefile
.
If you just want to see if the latest git poppler works better than the distro package, you don't need to sudo make install
, you can just run utils/pdftotext
or whatever right from the source directory. It apparently tells the linker to embed the build path into the binary, as a library search path, so running /usr/local/src/poppler/utils/pdftotext
works, and finds /usr/local/src/poppler/libpoppler.so.52
.
If the latest poppler does work better than the distro-packaged poppler, you should install it to /usr/local/bin
with sudo make install
. When you upgrade to the next version of your distro, check your /usr/local. Often the new distro version will be newer than when you built it from source, so you should just remove your version from /usr/local/{bin,share,lib,man,include}
. (Or make uninstall
in the source dir, if supported).

- 36,492
- 15
- 194
- 265

- 328,167
- 45
- 605
- 847
-
1Thank you. I realize this is old, but the accepted answer is not really helpful as the INSTALL information is incorrect, and cmake is indeed needed as you wrote. Still working on dependencies, but this got me going; I'm a cmake neophyte so I needed a shove. – Linwood Jan 21 '17 at 18:08
-
1It seems they also improved their INSTALL file, saying pretty much the same now. – TorstenS Aug 05 '18 at 11:20
Their website explains it very clearly :
Poppler is available from git. To clone the repository use the following command:
git clone git://git.freedesktop.org/git/poppler/poppler
Once you download the source code, read the INSTALL
file where it says :
cd
to the directory containing the package's source code and type./configure
to configure the package for your system.Type `make' to compile the package.
Type `make install' to install the programs and any data files and documentation.
-
Their `INSTALL` file is the default auto-generated instructions, which don't actually apply to poppler. Their git tree doesn't include the autoconf outputs (including `configure`), only the inputs for autoconf/automake, and also cmake. I'm still trying to figure out which order to run things in. The usual `./configure && make -j4 && sudo make install` probably works with their tarball releases, but not git. – Peter Cordes Jun 16 '15 at 23:44
Since some time has passed and it seems there was some uncertainty, I also took a look.
At the end of 2021, their homepage says
We run continuous integration via the gitlab CI
I checked out their .gitlab-ci.yml which has many build tasks. It would seem these days we build libpoppler like this:
git clone git://git.freedesktop.org/git/poppler/test test.repo
mkdir -p build && cd build
cmake -DTESTDATADIR=`pwd`/../test.repo -G Ninja ..
ninja

- 989
- 8
- 27