使用iTextSharp从现有PDF表单生成多页PDF [英] Using iTextSharp to generate multiple page PDF from existing PDF Form

查看:169
本文介绍了使用iTextSharp从现有PDF表单生成多页PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可填写的PDF表单,需要以编程方式填写每个成员并添加到单个pdf文档中。

I have a fillable PDF form which needs to be programatically filled for each member and added to a single pdf document.

我可以使用pdfstamper来阅读现有的pdf,并更改数据,但我似乎无法弄清楚如何在同一个pdf文档中使用不同的数据创建pdfstamper的多个实例。

I am able to use pdfstamper to read the existing pdf, and change the data, but I cant seem to figure out how to create multiple instances of the pdfstamper with different data in the same pdf doc.

推荐答案

你没有。一个PDF压模 - > 1个文件OUTPUT。你没有提供很多细节,但你的工作流程可能需要这样:

You don't. One PDF stamper->1 document OUTPUT. You didn't give a lot of detail, but your workflow will probably need to be something like this:

对于每个PDF表格:

*用压模打开它

*填写

*打开展平

*保存(到内存或磁盘)

For Each PDF form:
* Open it with a Stamper
* Fill it in
* turn on flattening
* Save it (to memory or disk)

创建PdfCopy(或SmartCopy)

Create a PdfCopy (or SmartCopy)

对于每个中间PDF

*将其插入Pdf * Copy

For each intermediate PDF
* Insert it into Pdf*Copy

保存您的最终文档。

没有效率,但那是如何使用iText。

None too efficient, but that's how it works with iText.

PS:在将多个表格合并在一起时,您确实需要展平表单,特别是当您拥有相同表单的多个副本时。在PDF中,共享名称的字段也共享一个值。

PS: You really do need to flatten your forms when merging multiple forms together, PARTICULARLY when you have multiple copies of the same form. In a PDF, fields that share a name also share a value.

这篇关于使用iTextSharp从现有PDF表单生成多页PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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