从头开始创建.pdf的最佳Perl模块是什么? [英] What is the best Perl module to use for creating a .pdf from scratch?

查看:105
本文介绍了从头开始创建.pdf的最佳Perl模块是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CPAN上有很多与.pdf文件的创建和操作有关的模块,我希望这个社区可以为我节省一些时间去逛盲巷.

There are quite a number of modules on CPAN relating to the creation and manipulation of .pdf files, and I'm hoping this community can save me some time going down blind alleys.

我希望从头开始创建.pdf文件,并且仅使用简单的格式(例如,粗体/斜体和左/右/中心对齐).从MVC的角度来看,能够使用模板文件会很好,但是如果最好的模块不支持该文件,那么我可以.我想要最适合我的狭窄问题集的最佳模块.

I am looking to create .pdf files from scratch, with only simple formatting such as bold/italic and left/right/center justify. Being able to use a template file would nice, from an MVC perspective, but if the best module doesn't support that, I'm ok. I want the best module for my narrow problem set.

编辑:让我们添加一个约束,即如果不是纯Perl解决方案,它必须是Perl模块.到目前为止,谢谢您的回答!

let's add the constraint that it does have to be a Perl module, if not a pure-perl solution. Thanks for answers thus far!

更新:PDF的创建是决定如何处理的一个难题.除了这里的好建议之外,似乎还有大约1,000种不同的方法可以解决此问题,而要知道哪种解决方案可以花费您的时间是一个真正的挑战.在构建此解决方案的过程中,很容易获得对外部可执行文件的依赖,这就是为什么我一直倾向于在Perl中做所有事情的原因.

Update: PDF creation is one difficult problem to decide how to approach. In addition to the good suggestions here, there seems to be about 1,000 different ways to solve this, and knowing which solution(s) to invest your time in is a real challenge. It is easy to acquire dependencies on outside executables in the process of building this solution, which is why I have been favoring doing everything in Perl if possible.

我走上了尝试使用PDF :: Create的道路,但发现它太局限了.您必须给坐标以放置每个文本字符串,并且没有内置的自动换行概念...这是您要做的所有工作.我的任务没有必要的开销.

I went down the road of trying to use PDF::Create but found it too limiting. You have to give coordinates to place each string of text and there is no built-in concept of text wrapping... this is all work you have to do. Impossible amount of overhead for my task.

我现在正在使用PDF :: API2,它比PDF :: Create的功能要强大得多,但仍然要求将PDF组装到一个令人担忧的低水平.幸运的是,在线上有一些帮助.请参见 Rick Measham出色的PDF :: API2教程,并附带了text_block()子例程,值得庆幸的是,该教程在文字换行问题上做了繁重的工作.

I am now using PDF::API2, which is much more powerful than PDF::Create, but still demands the PDF be assembled at a troublingly low level. Luckily, there is some help online. See Rick Measham's excellent PDF::API2 tutorial with accompanying text_block() subroutine, which thankfully does the heavy lifting on the text wrap problem.

除非您在这里看到另一个更新,否则这是最终为我工作的解决方案.

Unless you see another update here, this is the solution that ended up working for me.

推荐答案

我是CPAN模块的作者 CAM :: PDF 绝对不是这项工作的最佳工具-它是为高性能编辑而不是创建而设计的.

I'm the author of the CPAN module CAM::PDF which is definitely not the best tool for this job -- it's designed for high-performance editing, not creating.

在免费的PDF创建库中,我最喜欢PDF :: API2.它具有非常丰富的功能集和良好的加密支持(受CAM :: PDF的启发,我可能会添加!)作者Alfredo管理着一个受欢迎的电子邮件列表.人们有时会抱怨文档,但是我发现它足够了.

Among free PDF creation libraries, I like PDF::API2 the best. It has a very rich feature set and good encryption support (inspired by CAM::PDF I might add!) The author, Alfredo, manages a popular email list. People sometimes complain about documentation, but I've found it to be adequate.

在商业图书馆中,我对pdflib有很好的经验.

Among commercial libraries, I've had good experiences with pdflib.

这篇关于从头开始创建.pdf的最佳Perl模块是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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