我遇到过许多使用PDFBox Layer Utility的appendFormAsLayer方法的示例,如下所示:
/**
* Places the given form over the existing content of the indicated page (like an overlay).
* The form is enveloped in a marked content section to indicate that it's part of an
* optional content group (OCG), here used as a layer. This optional group is returned and
* can be enabled and disabled through methods on {@link PDOptionalContentProperties}.
* @param targetPage the target page
* @param form the form to place
* @param transform …Run Code Online (Sandbox Code Playgroud)