使用 Apache FOP 添加 PDF 可填写表单(acrofield) [英] Adding a PDF fillable form (acrofield) using Apache FOP

查看:43
本文介绍了使用 Apache FOP 添加 PDF 可填写表单(acrofield)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将可填写的表单(以便最终用户可以使用 acrobat 阅读器将信息插入其中,然后将其保存)添加到我使用 Apache FOP 生成的 PDF.如果可能的话,我似乎无法找到有关如何完成此操作的任何信息.

I am trying to add a fillable form (so the end-user can insert information into it using acrobat reader and then save it) to a PDF I generate using Apache FOP. I can't seem to find any information on how this is done, if it is possible.

Google 没有提供太多相关信息,主要是因为这是不可能的,但大部分信息可以追溯到 2000 年代初.

Google doesn't give much relevant information, mostly on the fact that it's not possible, but most of that information dates from the early 2000's.

有没有办法使用 FOP 添加 acrofields?

Is there a way to add acrofields using FOP?

推荐答案

(披露:我是 FOP 开发人员,虽然现在不是很活跃)

作为 FOP 的输入语言的 XSL-FO 语言没有格式化对象定义表单字段,因此 FOP 无法从头开始创建 AcroForms(您需要开发扩展程序 来实现那个).

The XSL-FO language, which is FOP's input language, does not have formatting objects defining form fields, so FOP cannot create AcroForms from scratch (you would need to develop an extension to achieve that).

然而,正如用户 @mkl 在评论中所说,PDF 图像插件 允许在 FOP 创建的最终 PDF 中包含现有 PDF 文件中的页面,就像它们是图像一样;根据发行说明,该插件提供对 AcroForms(PDF 表单)的有限支持".

However, as user @mkl told in a comment, the PDF images plugin allows to include pages from an existing PDF file in the final PDF created by FOP, as if they were images; according to the release notes, the plugin provides "limited support for AcroForms (PDF forms)".

因此,如果您已经有一个 PDF 表单,您可以像使用普通图像一样使用它:

So, if you already have a PDF form you can either use it like a normal image:

<fo:block>
    <fo:external-graphic src="my-doc.pdf#page=1"/>
</fo:block>

或在 fo:page-sequence 级别插入带有扩展元素的所有页面:

or insert all of its pages with an extension element at the fo:page-sequence level:

<fo:page-sequence>
    <!-- ... -->
</fo:page-sequence>

<fox:external-document src="my-doc.pdf" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"/>

这篇关于使用 Apache FOP 添加 PDF 可填写表单(acrofield)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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