Rails PDF 生成替代 Prawn

发布于 2024-10-06 19:27:53 字数 254 浏览 0 评论 0原文

我一直在使用 Prawn 生成简单的发票 PDF。我现在需要创建一个更复杂的 PDF 文档和 虾即将短缺。我需要精确复制现有布局,因此不能选择从 HTML(类似 Princely)进行转换。

任何人都可以推荐一个好的替代方案,或者任何替代方案吗?

I've been using Prawn to generate simple invoice PDFs. I now have the need to create a more complicated PDF document and Prawn is coming up short. I need to copy an existing layout precisely so converting from HTML (a la Princely) is not an option.

Can anyone recommend a good alternative, or any alternative for that matter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

烟酒忠诚 2024-10-13 19:27:53

iText 可能是任何语言的开发人员生成 PDF 的最佳答案。这对您来说不是一个完美的答案,因为它是一个 Java 库。然而,您可能会发现值得花时间来建立一个 Java 程序,该程序获取数据并与 iText 一起输出 PDF。

您还可以通过 Groovy 与 iText 交互。

http://itextpdf.com/

iText is probably the best answer that developers of any language have for generating PDFs. It isn't a perfect answer for you because it is a Java library. However, you may find it worth your time to stub out a java program that takes the data and works with iText to output a PDF.

You can also interface with iText through Groovy.

http://itextpdf.com/

风吹雨成花 2024-10-13 19:27:53

iText 非常有用。它有一个名为 pdf-stamper 的 Ruby 包装器,它允许您在字段中填充文本 - 这对于发票很有用。

我分叉了它并添加了一些功能(复选框、画圆圈等):
https://github.com/paulschreiber/pdf-stamper

iText is very useful. There's a Ruby wrapper around it called pdf-stamper, which allows you to fill text in fields — which would be useful for an invoice.

I forked it and added a few features (checkboxes, drawing circles, etc.):
https://github.com/paulschreiber/pdf-stamper

攒眉千度 2024-10-13 19:27:53

iText 相当有用。您可以使用它在输入 PDF 的已知位置标记文本,或填写输入 PDF 中的表单字段。 iText 的当前版本是 AGPL,但之前的版本是 LGPL。要从 Ruby 使用此功能,您需要使用 jrbJRuby

pdftk 是一个包装 iText(旧版本)的命令行工具。神奇的是,您不需要安装 JRE 即可使用 pdftk。您可以从任何 Ruby 中调用 pdftk。

iText is rather useful. You can use it to stamp text in known places on an input PDF, or to fill in form fields in an input PDF. The current version of iText is AGPL'd, but prior versions are LGPL'd. To use this from Ruby, you would either need to use jrb or JRuby.

pdftk is a command-line tool wrapping (an older version of) iText. Magically, you do not need a JRE installed to use pdftk. You can shell out to pdftk from within any Ruby.

隔岸观火 2024-10-13 19:27:53

pdfkit 使用自定义 webkit 后端来解释网页,并将其转换为 pdf。我们广泛使用它。令人高兴的是,如果您已经了解 html,那么创建模板就非常简单。糟糕的是 css 打印支持在 webkit 中并不是最好的,所以你可能会遇到一些关于更复杂的页码或分页的问题。

pdfkit uses a custom webkit backend to interpret a web page, and convert it to pdf. We use it extensively. What is nice is that if you already know html, it is extraordinarily simple to create templates. What kind of sucks is that css print support is not the greatest in webkit, so you may run into some issues around more complex page numbering or page breaking.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文