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?
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.
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. –
Analogy 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).
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.
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. –
Analogy 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
If you want to install poppler
from source without affecting the poppler
from your system (distro provided) I recommend JHBuild, as easy as:
jhbuild buildone poppler-data poppler-test-files poppler
© 2022 - 2024 — McMap. All rights reserved.
apt-cache search pdftotext
suggests to install thepoppler-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. – Hypnotismapt-get install libpoppler-dev
– Hypnotism