如何在服务器上安装Pdftk? [英] How do I install Pdftk on my server?

查看:524
本文介绍了如何在服务器上安装Pdftk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Linux Server并尝试安装Pdftk,但是在试图弄清楚该怎么做时遇到了问题.

I am using a Linux Server and am trying to install Pdftk, but I am problems trying to figure out what exactly to do.

我找到了以下有关如何安装它的文档,但是他们主要是指在本地Windows计算机上安装它.

I found the following documentation on how to install it, but they refer mostly to installing it on the local Windows machine.

它们是: http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/

http://www.accesspdf.com/pdftk/#packages

有人可以帮我弄清楚我需要在服务器上放置哪些文件以便可以参考pdftk吗?

Can someone help me unserstand exactly what files I need to place where on my server so I can refer to pdftk?

推荐答案

Pdftk是iText的一个版本,已从Java转换为c ++,并使用命令行桥进行了重建,以方便从PHP应用程序访问.

Pdftk is a version of iText which has been converted from Java to c++ and rebuilt with a command-line bridge for easy access from PHP applications.

要在Redhat/CentOS上构建pdftk,请遵循以下说明.

To build pdftk on Redhat / CentOS please follow the below instructions.

ssh [server to install pdftk on]

现在我们已经在服务器中,我们需要创建目录来存储pdftk.

Now that we are in the server we need to create the directories to store pdftk.

cd /
sudo mkdir extra
cd extra
sudo mkdir src
cd src
sudo wget http://www.pdfhacks.com/pdftk/pdftk-1.41.tar.gz
sudo tar zxvf pdftk-1.41.tar.gz
cd pdftk-1.41/pdftk

现在我们需要安装gcj库.

Now we need to install the gcj libraries.

sudo yum install java-1.4.2-gcj-compat-devel.i386

gcc-c ++库未随gcj软件包一起安装,因此我们将立即安装它,因此在编译过程中不会出现错误.

The gcc-c++ library doesn't get installed with the gcj package so we will install it now, so we don't get an error halfway through the compile process.

sudo yum install gcc-c++

如果立即编译该应用程序,则会收到一条警告,提示您使用tmpnam是危险的,应使用mkstemp.

If you compile the application right now you will receive a warning that tmpnam is dangerous to use and you should use mkstemp.

sudo vi report.cc

从VI内部运行此命令以进行搜索并替换为tmpnam方法.

Run this from inside VI to do a search and replace for the tmpnam method.

:%s/tmpnam(/mkstemp(/g

按Escape键并使用保存更改

Press escape and save the changes with

:wq!

现在我们已经安装了所有软件包,我们将开始编译pdftk-1.41

Now that we have all the packages installed, we are going to start compiling pdftk-1.41

从/extra/src/pdftk-1.41/pdftk运行以下命令

from /extra/src/pdftk-1.41/pdftk run the following command

sudo make -f Makefile.RedHat

这将启动将Java文件编译并将其转换为c ++的构建过程.将iText转换为c ++可能需要花费几分钟.在休息室里从我们的新玛格丽塔机器中获取玛格丽塔:).

This will kick off the build process for compiling and converting the java file to c++. This could take SEVERAL minutes to convert iText to c++. Go grab yourself a margarita from our new margarita machine in the break room :).

现在,随着pdftk文件的创建,我们将其复制到/bin目录,以便我们可以在任何地方运行它.

Now with the pdftk file created we will want to copy it to the /bin directory so that we can run it from anywhere.

sudo cp pdftk /usr/local/bin

让我们确保构建成功并运行

Let's make sure the build was successful and run

pdftk --version

这篇关于如何在服务器上安装Pdftk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆