How to create interactive form with fixed pages using Adobe LiveCycle API?

1.2k Views Asked by At

When I try to open a regular PDF (which doesn't contain an XFA form) using Adobe LiveCycle ES4 Designer it prompts a window (New Form Assistant) and asks me to select how I want to work with the PDF. The options are:

  • Create an Interactive Form with Fixed Pages
  • Create an Interactive Form with a Flowable Layout

I choose the first one and continue. Then, without doing anything I save the file (using save as). Save as type is 'Acrobat (Static) PDF Form (.pdf)*', and as a matter of fact that's the only option for this scenario. After I save the file, I figured out that, although both files are visually same in the PDF reader, the saved and the original files are different, such that, saved file contains XFA form. In my case XFA form is as follows:

<topmostSubform xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup"/>

I have two questions about this.

  1. Can I open a regular PDF and add an XFA form to it without corrupting the original PDF content, using the API?
  2. If the first one is possible, can I add invisible fields to that PDF, again using the API?

In short, what I want to do is adding a filled XFA form to a regular PDF and I'm asking if it is possible, using the API?

2

There are 2 best solutions below

4
On BEST ANSWER

There is no API in Adobe LiveCycle that lets you insert an XFAF (XFA Foreground) form into a PDF.

It should be doable using various PDF libraries however. You need to create the form you want to add and then insert it into the PDF using a PDF library like iText, PDFBox or Big Faceless. Inserting is a little tricky however as the XDP is broken into sections in the PDF. I would generate a XFAF PDF using LiveCycle Designer and then examine it using the same PDF library that you intend to reproduce the process with.

The presence attribute isn't specifically excluded from the XFAF profile, so invisible fields should work, however I would test it with LiveCycle Designer first. If you add invisible fields into a Fixed Page PDF and it works (i.e. you test the resulting PDF - I have no doubt that it will let you add them but it's possible that it doesn't make them invisible) then you should be able to emulate that using a programatically constructed XFAF PDF.

Just a word of caution. This is not something that I think many people outside of the LiveCycle Designer team have tried. If you head down this route you will be blazing the trail.

4
On

When you select “Create an Interactive Form with Fixed Pages”, what is happening conceptually is that you are creating an XFA “overlay” on the existing PDF. You can add fields but not boilerplate.

The intended use case, is that you have an existing paper form that you have in PDF format and that you want to quickly add fields to it in order to make it interactive. You are essentially augmenting the existing PDF with some additional XFA functionality. Since the artwork remains in PDF, no conversion has occurred on it and it remains identical to the original unaltered document. You are, however, not creating a true XFA form because only the fields are defined in the XFA format so you cannot store it as an XDP. It can only be re-saved as a PDF. Also, since the PDF artwork is not broken down into moveable pieces (i.e. subforms), the form cannot grow/shrink dynamically. This is why it can only be saved as a static PDF. See the Adobe LiveCycle Designer help here and here.

When you select “Create an Interactive Form with a Flowable Layout”, Designer is converting the PDF into the XFA XML format. You can interact with the design just as if you had created everything from scratch using LiveCycle Designer.

Since this approach actually converts the PDF artwork into XML, there is a higher likelihood that some of the artwork may not convert exactly the same. It may require some manual fixups to get the form looking exactly as it did before. Some complex PDFs may not convert well at all. Fonts may not be available, etc. Again, this is covered under the Adobe LiveCycle Designer help here.

The benefit of this latter approach is that you have a full XFA form definition that can be used anywhere that a form that was developed from the ground up in LiveCycle Designer can be used. It can be modified to add dynamic sections that grow or shrink to match the data. The entire expressive power of an XFA-based form is opened up.

WRT your questions:

  1. You can open a regular PDF and add XFA fields to the form. You can then use those fields to capture data and save that data out as XML data.

  2. You can add invisible XFA fields as well.