Apologies if this question has been addressed before, but I couldn't
find an exact answer when reading through the mail archives...

What I'm attempting to do is have our application read in a pdf forms
created using Adobe Livecycle designer, fill in the form textfields with
data, stamp the form, and add the page to a PdfCopy object.  This
functionality currently works (I followed the example listed on page 64
of the iText in Action book).  However, when I attempt to change any of
the properties for the fields, such as changing a font, making text
bold, or changing the borders of the textfield, the textfield does not
change, and the setFieldProperties function returns false.  Is this due
to an incompatibility between iText and forms designed in Livecycle 7?
If so, is there a known workaround?

Code snippet:

PdfReader reader = new PdfReader("template.pdf");
Document document = new Document(reader.getPageSizeWithRotation(1));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfCopy copy = new PdfCopy(document,baos);
document.open();

PdfStamper stamper = new PdfStamper(reader, new
ByteArrayOutputStream());
AcroFields form = stamper.getAcroFields();

// fill in form fields, this works correctly
form.setField("Field1", "text");
// etc..

if (condition) {
        // change textfield proprties, this function returns false and
does not change the border color
        form.setFieldProperty("Field1", "bordercolor",
java.awt.Color.BLACK, null);
}

stamper.close();
copy.addPage(copy.getImportedPage(reader, 1));
document.close();

Thanks in advance,

Neal Febbraro
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to