Given a PDF form with fields already specified, I want to be able to put something like this in one of the form fields:
Rodrigo, you are NOT the father!
Using iTextSharp, I can accomplish this (albeit a bit painstakingly) using Rich Text values and passing in XML representing the content with the appropriate bold markup, as per this answer.
However, according to that same answer (and my firsthand experience), you cannot lock+flatten the form (to prevent further editing) after you have done this. Unfortunately, that is also necessary in this case.
The author of the previously-mentioned answer mentions that this can possibly be worked around by "[having Javascript] that resets the field value when the form its opened to force Acrobat/Reader to build the appearance[s] for you."
How do you add Javascript code to a PDF (preferably via iTextSharp itself, although we may be able to do it on the back-end in the file itself) such that it executes when the form is opened to force the PDF reader to build appearances for you?
Moreover, will this allow us to not have to say GenerateAppearances = false
and therefore allow us to lock and flatten the form?
If not, is there something other than iTextSharp that will allow us to make certain words in a form field bold but also lock and flatten the form to prevent future editing once we're done?