You were doing fine up to this statement:

>Second, since this is a static XFA form, I can use the normal AcroForms APIs in IText:
>
This won't work! As soon as the user opens the PDF in Acrobat/ Reader, the (unmodified) XFA data will be used to RECREATE the AcroForm - thus throwing away all the work on did on the server. INSTEAD, you need to forget about the fact that there is an AcroForm there - and instead read out the XFA data sets grammar, modify it using standard XML techniques, and then put it back (as part of the appended PDF pieces). That will work fine.

        And if you go this route - you can do your rich text fields as well.

Leonard


On Jun 10, 2008, at 11:29 AM, Demling, Peter wrote:

(First off, thank you for the very useful API, book and forum).

I've been charged with providing a proof-of-concept as soon as I can for servlets to perform the following tasks using XFA forms. I'm pushing hard for us to use iText, so I've read every message and FAQ posted in the past year that mention XFA. I think I've designed it correctly, but since this touches on some tricky forms issues (reader-enabling, etc), could someone reply if you they see a flawed assumption about iText functionality? My servlets will: Open a static XFA Form created in AcrobatPro 8.1 (i.e. with LiveCycle Designer) with reader-saving rights enabled, that has no data yet (call it a 'template' if you'd like). Populate this template's Form fields with data values (making no direct changes to the pdf itself); save it as a new pdf, and download this editable/savable/filled-in pdf to the user (user will then edit and save offline in Reader). In a second servlet, upload this user-updated XFA form, and read in the new Form field values. As I understand it, creating a filled-in form in this way will not break the reader-enabled saving in the new pdf, since all I'm doing is setting Form field values and saving a pre-filled copy like "questions.forms.FillEnabledForm" does (side note: I remain in agreement with the EULA regarding reader-enabling since I have less than 500 users).

Second, since this is a static XFA form, I can use the normal AcroForms APIs in IText: I don't ever have to read or write to the XFA structure itself, and the iText code for this purpose will be exactly the same (opening template, setting form data, saving editable copy, reading in updated form).

Last, even though we would ideally like some XFA Form fields to be of type "richText" (to allow users to do things like bold, underline, etc), it is not possible to simply set the value of such a Form field with XHTML content via iText (I would need to directly modify the pdf outside of the form fields, which would break the reader-enabling). I can however use '\n' and '\t' to insert line breaks and tabs in a plain text field (and I could even create bulleted lists with creative use of '\n', '\t' and dashes/numbers if I wanted to).

Thanks for any feedback! The docs are great; the only thing I couldn't determine is if it would be less of a headache to just create an acroForm in AcrobatPro 8.1 (which uses LiveCycle Designer) instead of XFA. I don't even know if this is possible; but if the iText code is exactly the same for the above-stated purposes, then I'm assuming it doesn't matter anyway.

Regards,
-Peter Demling
M.I.T. Lincoln Laboratory
Lexington, MA
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to