4

我只是将 poppler 下载到 Linux 系统,我想将它合并到我的应用程序中以解析 pdf 文件。
(我的目标是将 pdf 文件转换为纯文本。)
我该怎么做?

4

3 回答 3

10

Poppler 的 git 树包含一个无用的INSTALL文档,它只是告诉您运行./configure,但它们不包括 git 中的 automake/autoconf 自动生成的文件(包括配置)。(可能他们确实将它们包含在 tarball 源代码版本中。)

我刚刚从 git 源(在 Ubuntu 15.04 上)构建了 poppler,如下所示:

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

他们似乎维护了一个 autoconf/automake 构建设置,因此您可以使用该 OR cmake 创建一个Makefile.

如果你只是想看看最新的 git poppler 是否比发行版包更好,你不需要sudo make install,你可以utils/pdftotext从源目录运行或其他任何东西。它显然告诉链接器将构建路径嵌入到二进制文件中,作为库搜索路径,因此运行/usr/local/src/poppler/utils/pdftotext正常,并找到/usr/local/src/poppler/libpoppler.so.52.

如果最新的 poppler 确实比发行版打包的 poppler 工作得更好,你应该将它安装/usr/local/binsudo make install. 当您升级到发行版的下一个版本时,请检查您的 /usr/local。新的发行版通常会比你从源代码构建时更新,所以你应该从/usr/local/{bin,share,lib,man,include}. (或make uninstall在源目录中,如果支持)。

于 2015-06-17T00:13:46.770 回答
0

他们的网站解释得很清楚:

Poppler 可从 git 获得。要克隆存储库,请使用以下命令:

git clone git://git.freedesktop.org/git/poppler/poppler

下载源代码后,请阅读INSTALL其中显示的文件:

  1. cd到包含包的源代码的目录和类型 ./configure以为您的系统配置包。

  2. 输入“make”编译包。

  3. 键入“make install”来安装程序和任何数据文件和文档。

于 2012-01-17T07:53:56.360 回答
0

由于时间过去了,似乎有一些不确定性,我也看了看。

在 2021 年底,他们的主页上写着

我们通过 gitlab CI 运行持续集成

我检查了他们的 .gitlab-ci.yml,它有很多构建任务。这些天我们似乎像这样构建 libpoppler:

git clone git://git.freedesktop.org/git/poppler/test test.repo
mkdir -p build && cd build
cmake -DTESTDATADIR=`pwd`/../test.repo -G Ninja ..
ninja
于 2021-12-31T13:52:29.427 回答