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

查看:246
本文介绍了使用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添加Acrofield?

Is there a way to add acrofields using FOP?

推荐答案

(公开:我是一名FOP开发人员,尽管如今不是很活跃)

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

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 在评论中说的那样,

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天全站免登陆