PDFNet包的安装与使用-附:安装Swig
本帖最后由 shaoheshaohe 于 2020-4-27 16:39 编辑第一部分 准备
Custom Python wrapper & Linux PDF library integrationThis guide will help you run PDFTron samples and integrate a free trial of the PDFTron SDK into Python applications on Linux. Your free trial includes unlimited trial usage and support from solution engineers.There are two ways to use PDFTron with Python:
[*]Use the precompiled library for Python 2.7.
[*]Use PDFNet bindings to build your own wrapper.
This guide will help you get started by building your own wrapper. You can find more information about using the precompiled library .
Prerequisites
[*]Python3 or Python2 with developer extensions
[*]CMake version ≥ 2.8
[*]SWIG 2.0.4 - 2.0.12 or SWIG 3.0.12
[*]PDFTron SDK for Linux:下载开发包
第二部分 安装
Initial setup
[*]Make a directory to store the wrappers and navigate into that directory.
[*]Clone the uncompiled PDFNet wrappers project by executing
git clone https://github.com/PDFTron/PDFNetWrappers
[*]Navigate to PDFNetWrappers/PDFNetC and 将下载的PDFNetC64.tar.gz解压 into that directory. Ensure you obtain the right architecture for your Python interpreter. For example, if your interpreter is 64bit (which this guide will assume), execute
wget http://www.pdftron.com/downloads/PDFNetC64.tar.gz
[*]在PDFNetC目录, execute
mv PDFNetC64/Headers/ .
and
mv PDFNetC64/Lib/ .
to move the PDFNet libraries in place.
Your /PDFNetC folder should be laid out like this like this:PDFNetC
├── Headers
├── Lib
├── PDFNetC64
└── README.txt
[*]Make a build directory inside /PDFNetWrappers and navigate to it. This guide will assume the build directory is called Build.
[*]在Build目录,Execute
cmake -D BUILD_PDFNetPython=ON ..
If all goes well, you should get a message which reads: 【成功时,你将读到以下信息】Build files have been written to ~/PDFNetWrappers/Build
[*]Execute make followed by sudo make install.
附:安装SWIG
sudo apt-get updatesudo apt-get install swig
可能会遇到“未安装apt-utils”
解决方法:
sudo apt-get update
sudo apt-get install apt-utils
然后再执行一次安装Swig的命令。
页:
[1]