Well, it happens to be that I have a table of text fields and yes, I loop
through them all to fill them with data.
The loop itself isn't too complicated, the tricky part is parsing the xml
from database and converting it to a data structure with names matching the
fields in the PDF.
' -------- This is the loop going through the fields and matching them to
the parsed data in cData
Dim formFields As AcroFields = stamper.AcroFields
Dim ofield As New DictionaryEntry
For Each ofield In stamper.AcroFields.Fields
If cData.ItemExist(ofield.Key) Then
stamper.AcroFields.SetField(ofield.Key,
cData.Item(ofield.Key).Value)
End If
Next
stamper.Close()
' ----------
This of course requires that I know the names of the fields beforehand,
which I do since I created the PDF myself.
Perhaps the XFA solution is simpler, but as I said I'm no expert in XML and
this does the job.
Still interested in seeing your solution though! / Fredrik
2009/10/28 claud108 <claud...@yahoo.com>
>
> This will solve simple PDFs.
>
> For PDFs with more complicated form inside will be very hard to standardize
> the class you use.
> For instance, if you would have repetitive structures, as rows in a table,
> you would have to address each field, for instance in a loop, and so on ...
> Too complicated.
>
> This is why I said that using XFA is simple and elegant.
>
> Claudius
> --
> View this message in context:
> http://www.nabble.com/Can%27t-save-PDF-after-filling-in-form-fields-with-iTextSharp-tp26078435p26092878.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/