Adding a PDF fillable form (acrofield) using Apache FOP

前端 未结 1 1242
情深已故
情深已故 2021-01-06 21:08

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

相关标签:
1条回答
  • 2021-01-06 21:46

    (disclosure: I'm a FOP developer, though not very active nowadays)

    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).

    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)".

    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>
    

    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"/>
    
    0 讨论(0)
提交回复
热议问题