1

I am having an issue using Adobe LiveCycle Designer in conjunction with iTextSharp. I have a multi-line text field that I'm stamping That looks like...

Blah blah text here: _________________
______________________________________
______________________________________

In LiveCycleDesigner, I have a single field that encapsulated all 3 lines (including the static text). I've set the font/paragraph settings so that the first line indents over to where the field starts, the field aligns vertically, and the lines are spaced properly.

When I use PdfStamper to set the fields (without flattening the form), it looks fine in Adobe (though Chrome and Firefox default plugins don't seem to support AcroForms very well). When I flatten the form, though, I lose everything but the font.

Does iTextSharp just not support the ability to do this? Is there some better way I should be doing this? I'm trying to build a generic form builder for my application, so a one-off fix won't really be useful for me.

The only alternative I've thought of is to break it into 3 fields on the PDF and use some clever grouping and MeasureString() (UGH) to determine how much of my string can fit in each field. Can anyone think of anything better?

Dave
  • 900
  • 6
  • 22
  • I assume that you have read [the documentation](http://pages.itextpdf.com/ebook-stackoverflow-questions.html) and that you are flattening a *pure XFA form* like this: `using (PdfStamper stamper = new PdfStamper(reader, ms)) { AcroFields form = stamper.AcroFields; XfaForm xfa = form.Xfa; xfa.FillXfaForm(XmlReader.Create(new StringReader(xml))); }` If not, please share your form (maybe it's a *hybrid XFA form*) and your code (maybe you're filling it as if it were an AcroForm form). – Bruno Lowagie Apr 09 '15 at 07:03
  • Here is a link to an example. I believe that I misused the term XFA and mean AcroForm fields. I Updated the question to reflect that this is not an XFA document. https://drive.google.com/file/d/0B71GBjTQTjxXdEkybUdRd05SLTQ/view?usp=sharing – Dave Apr 09 '15 at 12:09
  • It's a hybrid form. This means that the form is present as AcroForm as well as as XFA form. XFA technology has more functionality than AcroForm technology, which may very well explain why you claim that specific properties are "removed." You are flattening the form as if it were a pure AcroForm, hence you are throwing away some of the XFA specific properties. This doesn't happen when you don't flatten the form. – Bruno Lowagie Apr 09 '15 at 12:59
  • Thanks for the information, Bruno. Is it a better alternative, then, to just mark the fields read-only and then leave the form unflattened? The only other problem I am seeing is that Firefox and Chrome don't seem to support the XFA properties either, but according to Adobe's website that should be expected. – Dave Apr 09 '15 at 13:05
  • Why not create either a pure AcroForm template or a pure XFA template that behaves exactly the way you want. That will provide a much better result than any workaround you might try to avoid a problem caused by using a hybrid form. – Bruno Lowagie Apr 09 '15 at 13:07
  • That is most likely worth looking into, but a couple reasons: mainly that I won't necessarily be building all (or any) of the forms and need to be able to establish a) some simple best practices for my application's usage that a real estate agent could understand and b) as simple a path as possible to convert new forms from however they've been created to something that works in our application to reduce our costs in officially supporting new forms. – Dave Apr 09 '15 at 13:13

0 Answers0