如何在ruby中组合PDF? [英] How do you combine PDFs in ruby?
问题描述
这是问的问题在2008年。希望现在有一个更好的答案。
This was asked in 2008. Hopefully there's a better answer now.
如何在ruby中组合PDF?
How can you combine PDFs in ruby?
我正在使用 pdf-stamper gem 以PDF格式填写表格。我想要 n PDF,在每个PDF中填写表格,并将结果保存为 n 页面文件。
I'm using the pdf-stamper gem to fill out a form in a PDF. I'd like to take n PDFs, fill out a form in each of them, and save the result as an n-page document.
你能用像prawn这样的本地库来做这件事吗?你能用rjb和iText做到这一点吗? pdf-stamper是iText的包装器。
Can you do this with a native library like prawn? Can you do this with rjb and iText? pdf-stamper is a wrapper on iText.
如果可能,我想避免使用两个库(即pdftk和iText)。
I'd like to avoid using two libraries (i.e. pdftk and iText), if possible.
推荐答案
我写了一个ruby gem来做这件事 - PDF ::合并。它使用iText。以下是您如何使用它:
I wrote a ruby gem to do this — PDF::Merger. It uses iText. Here's how you use it:
pdf = PDF::Merger.new
pdf.add_file "foo.pdf"
pdf.add_file "bar.pdf"
pdf.save_as "combined.pdf"
这篇关于如何在ruby中组合PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!