XML for fillable PDF form?

I would like to create a fillable PDF form via an XML document?

We currently have a database with positions for the checklist, which is then displayed in xml format. We can create some good HTML 5 checklists, but now we're moving on to PDF forms.

I already did some searches, but there is nothing really final for creating PDF from XML. We want to determine which fields are needed, drop-down lists, text fields, etc.

How can I create a completed PDF form with an XML document?

+4
source share
1 answer

Addendum (see comment): I am the CEO of iText Software Group, the original developer of iText (an open source PDF library) and the author of two iText in Action, books published by Manning. I am a member of NBN, which is a Belgian standards office (including ISO-32000 and related PDF standards). I am not affiliated with Adobe, Open Office, etc.

There are two "flavor" forms in PDF: AcroForm and XFA based forms.

In AcroForm-based forms, a form is described using the PDF syntax, and each field has fixed coordinates. Think of it as digital paper. If you have a form representing an invoice, then such a form can provide 20 lines of invoices. Suppose you need fewer lines, you will have some unused fields that will remain visible. Suppose you need more lines; you cannot fit all of them into a form. I described how to create such a form using Open Office in chapter 6 of my book (see Section 6.3.5). The only XML link is that you can import / export such a form in XFDF format, which is the specification that is mentioned in ISO-32000-1. This is the XML version of the form data format (FDF). This might be ideal if you want to store user responses on the server in XML form. You can test this one here . Fill out the form and select the XFDF button. The servlet that receives your request will return the stream that was sent to the Adobe Reader server.

It may also be interesting to take a look at the XML Form Architecture (XFA). In this case, the PDF acts as a container for the XML stream. Embedded XML consists of various parts, of which the template and data sets are the most important. In the template, specific syntax is used to determine how the form should look (how it should be displayed by Adobe Reader). Part of the data set consists of a data description that resembles XSD and data. One of the main advantages of XFA is that the data is composed of XML, which uses whatever schema you want. XFA forms are usually created using the Adobe LiveCycle Designer, in which you import your own XSD as a data source, and then you can start developing your form. The result will be an empty template. Filling out a form is as simple as embedding your XML in a data tag.

What type of mold is best for you?

AcroForms are always static. If your form should be an exact match with the existing form on paper, this is your best match. If you need forms that can evolve dynamically (like HTML), you will soon be disappointed in AcroForms, although there are workarounds that seem to work just fine.

XML forms can be very dynamic. See, for example, a form for films . It consists of only one page. Now add an XML file with 120 films . The result is a 23-page form. As you can see, the fields for one movie are repeated 120 times. The field with the director and the country in which the film is produced can also be repeated if necessary. One of the main disadvantages is that such forms can only be presented in Adobe Reader; they are not displayed in Apple Preview and many other non-Adobe Adobe Reader.

I am not sure if this answer will help. If not, clarify how you seem to focus on details such as flags.

Addendum:

Yeah, after reading my question a second time, I now see that I misunderstood the question. You do not want to create an XML result after filling out the form. You want to create a form based on XML input (the point of view on input / output in your question is confusing).

So: you are not using Open Office, Adobe Acrobat, or Adobe LiveCycle Designer to create the form. You want to convert your own XML to an interactive PDF file. I do not know any software that allows you to create an XML-based XFA form, with the possible exception of Adobe LiveCycle ES. If AcroForms is acceptable, you need to write a parser for your own XML and use the PDF library to create the form. Such a PDF library may be iText (possibly in combination with a custom XML Worker implementation), but note that this will require additional programming.

There is no β€œoff-the-shelf” solution for automatically converting custom XML to an interactive PDF form.

+7
source

All Articles