Everyone, Can anyone help me figure out how to place fields on a PDF form in a particular tab order where some of those fields share the same datapoint name? To illustrate where I'm coming from, and perhaps preclude some to-and-fro, I have an extended multipart thought experiment. Consider a postcard with fields for a return address (FromName, FromStreet, FromCity), a destination address (ToName, ToStreet, ToCity), and the sender's name (SignedBy). My desired tab order is: FromName -> FromStreet -> FromCity -> ToName -> ToStreet -> ToCity -> SignedBy whereupon the tabbing repeats. Solving this is simple: Instantiate a TextField for each of these fields and write them to the document. The order you write these fields to the document shall be the tab order. Consider that SignedBy field. It holds the same information as FromName, and its stupid to ask for the same information twice. This is satisfied by two text fields named FromName near the upper left hand corner of the page and near the bottom of the page. This is less simple, but tractible: Instantiate "parent" PdfFormField that we'll name FromName and then instantiate "kid" TextField objects. You can use these kid objects' GetTextField() function to get a kid PdfFormField object to link to the parent via AddKid(). Then with parent and kids linked, we can write the parents to the document. This works except for the tab order: when we tab from the first kid of FromName, we want to jump to FromStreet, and when we tab from the second kid of FromName we'll want to jump to FromName's first kid. This doesn't happen. My experiments show that when I write the parent, FromName, it places both kids into the file at that time, resulting in the following tab order: FromName (top field) -> FromName (bottom field) -> FromStreet -> FromCity -> ToName -> ToStreet -> ToCity. But how can I tell iTextSharp to write FromName's first kid, then hold off on writing its second kid until after the field ToCity is written so as to preserve the desired tab order? Here's one thing I tried that (almost, but) doesn't work: Create all the kids, write them to the document in tab order. Link them to their parents. Write the parents to the document. You get all the fields in the desired tab order. But if you open the document and delve into its internals with the EnFocus low level PDF browser, you'll see there's duplication going on. The kids have been written to the document twice. This is kludgey, but it preserves tab order. I could live with this ugliness until I learned that Adobe Acrobat won't let you delete these fields, or in some versions dying horribly in the attempt. I did some searching and read Paolo's cryptic words that I only partially understood: Is this pertinent to my question? Can anybody point me to some sample code where this is done?You can change the tab order by changing the order that the fields appear in the annotation dictionary. Thanks in advance, I'm much obliged for all your help. smiles and cheers, steve poling grand rapids, MI |
------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H
_______________________________________________ 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