在共享的Web服务器上安装PDFTK [英] Installing PDFTK on a shared web server

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

问题描述

我的网站托管在使用某些Linux(我不知道确切的版本)和Apache的Total Choice Hosting上.我没有命令行访问权限-我只能通过PHP中的exec()或通过CRON作业来运行命令行程序.

My web sites are hosted on Total Choice Hosting using some kind of Linux (I don't know what precise variety) and Apache. I don't have command line access - I can run command line programs only via exec() in PHP, or via CRON jobs.

我可以在这样的系统上安装和使用PDFTK吗?

Can I install and use PDFTK on a system like this?

如果是,我该怎么办?我必须将哪些文件复制到哪里?我是否必须从源代码重建PDFTK,还是某处有可执行版本?

If so, what exactly do I have to do? Which files do I have to copy where? Do I have to rebuild PDFTK from source, or is there an executable version somewhere?

由于(据我所知),PDFTK是基于用Java编写的iText的.也许我最好使用原始的iText包?

Since (as I understand it) PDFTK is based on iText, which is written in Java. Maybe I'd be better off using the original iText package?

或者是否有更好的方法来做我想做的事情(基本上是将PDF文件(空白表格)与FDF文件(字段值)合并并展平为新的PDF文件(完整表格),然后将其下载给用户)?是否有一些本机PHP或Python或Perl代码可以做到这一点?

Or is there a better way of doing what I want to do (which is basically to merge and flatten a PDF file (blank form) with a FDF file (field values) into a new PDF file (the completed form) and download it to the user)? Is there some native PHP or Python or Perl code to do this?

谢谢-罗恩

推荐答案

快速浏览一下即可发现PDFTK源是C ++,看起来他们使用GCJ来将某些第三方Java代码编译为本机代码.如果找到与您的操作系统和体系结构匹配的PDFTK的预构建版本,则应该能够将二进制文件上传到系统并使用exec从PHP运行它.安装页面.

A quick glance reveals that the PDFTK source is C++ and it looks like they use GCJ to compile some 3rd party Java code to native code. If you find a pre-built version of PDFTK that matches your OS and architecture you should be able to just upload the binary to your system and run it from PHP using exec. There are some builds available on the install page.

有一些本地PHP库可用于创建和处理PDF.查看 TCPDF FPDF 这些都是可用的.每个人都应该支持您想要做的事情,这仅仅是选择正确的解决方案的问题.

There are some native PHP libraries available for creating and manipulating PDFs. Check out TCPDF, Zend_Pdf, and FPDF to see if any of those are usable. Each one should support what you want to do, its just a matter of choosing the right solution.

使用PDFTK可能是最快的选择,因为它是经过编译的代码,但它是可移植性最差的选择,因为它需要服务器上安装了该软件,PHP解决方案可以随您的代码一起分发.

Using PDFTK may be the fastest option since it is compiled code, but it is the least portable option since it would require the server have that software installed on it, where the PHP solutions could be distributed with your code.

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

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