3

I want to craete a PDF with XFA data but I don't want the XFA data to be visible when the PDF is viewed, however, I want it to be reachable via following code:

ByteArrayOutputStream baos = new ByteArrayOutputStream();       
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, baos);
AcroFields form = stamper.getAcroFields();
XfaForm xfa = form.getXfa();

How can I do this?

Thanks

guneykayim
  • 5,210
  • 2
  • 29
  • 61
  • If there is XFA information in a file, PDF viewers supporting XFA ignore the PDF'ish content and try to render the XFA form. But it obviously should be possible to have XFA data which is not displayed by the XFA form. – mkl Dec 15 '14 at 14:05

1 Answers1

3

Apparently what I asked is possible according to XML Forms Architecture (XFA) Specification Version 3.3. It can be done using XFAF. Under 'The Relationship between XFA and PDF' section in page 20 it says:

There is overlapping functionality between XFA and PDF. However the two grammars serve different purposes. XFA has a more abstract view of a form than PDF. XFA concentrates on the logic of a form whereas PDF concentrates on the appearance. However it is possible to combine the two. When the two are combined the result is a form in which each page of the XFA form overlays a PDF background. This architecture is sometimes referred to as XFAF (XFA Foreground).

guneykayim
  • 5,210
  • 2
  • 29
  • 61