[seam-dev] PDF fill-in-forms support

Nicklas Karlsson nickarls at gmail.com
Wed Aug 27 02:55:24 EDT 2008


Hi,

  Do you think that people would find use for Seam support of
populating fields of pre-generated PDFs?

  One scenario would be if you have a PDF with a complex layout that
you don't want to generate every time. You could create
the layout once and define the field names in Acrobat and then place
it in an accessable location (some sort of permanent
DocumentStore) and then have a tag like

   <p:form URL="#{formURL}">
      <p:field name="name" value="#{person.name}"/>
   </p:fillInForm>

The tag would then fetch the template, populate the fields and output
the generated PDF. The code itself in iText is very
simple (example operating on files):

      PdfReader reader = new PdfReader("c:/temp/form.pdf");
      PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("c:/temp/out.pdf"));
      AcroFields f = stamp.getAcroFields();
      f.setField("person.name", "Cthulhu von R'yeh");
      stamp.setFormFlattening(true);
      stamp.close();

Perhaps even some plugin-tag that would enable to save the generated
PDF to a database. Or something.

---
Nik



More information about the seam-dev mailing list