将带有 MergeFields 的 Word 文档转换为带有表单字段的 PDF

发布于 2024-09-18 08:57:59 字数 578 浏览 2 评论 0原文

我有一个 Word .doc 格式的文档模板。 Word 文档包含需要动态填充的合并字段。

我需要将 Word 文档转换为带有表单字段的 PDF。然后可以使用 iText 从我们的 Java 应用程序轻松填充此 PDF。

我遇到的问题是当我尝试将 Word 文档转换为 PDF 时。我希望将邮件合并字段转换为表单字段,但我尝试过的工具似乎都没有做到这一点。

我尝试过:

  • Microsoft Office 2007另存为PDF(仅创建PDF作为文本,没有表单字段)
  • PDFCreator(也只是文本)
  • Docx4j(我将文档保存为docx,然后转换为xml),它使用Apache FOP AFAIK(也只是文本,它将合并字段显示为 MERGEFIELD "Surname",而其他字段则显示 <>,如文档中所示)
  • 我尝试打开 PDF在 Scribus 中生成,但每个我都收到一个错误,指出它不是可接受的格式

有谁知道可用的工具或 Java 库可以满足我的需要(最好是免费的)?

I have a document template in Word .doc format. The Word document contains Merge fields that needs to be populated dynamically.

I need to convert the Word document to a PDF with form fields. This PDF can then be populated from our Java application quite easily with iText.

The problem I am experiencing is when I try to convert the Word document to PDF. I want the mail merge fields converted to to form fields but none of the tools I have tried seem to do that.

I have tried:

  • Microsoft Office 2007 save as PDF (Only creates a PDF as text, no form fields)
  • PDFCreator (Also just text)
  • Docx4j (I saved the doc as docx and then converted to xml) which uses Apache FOP AFAIK (Also just text, it displays the Merge fields as MERGEFIELD "Surname" while the others display <<Surname>> as it appears in the Doc)
  • I tried opening the PDFs generated in Scribus but each I just get an error that it is not in an acceptable format

Does anyone know of a tool or a Java library available that can do what I need (preferably free)?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文