Thanks to an old post from Paulo Soares (2006) I've been able to make the
content visible. See the code below:

       pdfR = New PdfReader("f:\aangifte_bpm_2010.pdf")
       pdfS = New PdfStamper(pdfR, New
IO.FileStream("f:\temp\test_bpm_aangifte.pdf", IO.FileMode.Create))

        Dim form As AcroFields = pdfS.AcroFields

        form.SetField("Naam", TextBox2.Text)
        form.SetField("Adres", TextBox3.Text)
        form.SetField("ParticulierOfOndernemer", "Ondernemer")

        'Added the line below
        form.SetFieldProperty("BTWnummer", "flags",
PdfAnnotation.FLAGS_PRINT, Nothing)

        form.SetField("BTWnummer", "123456789B01", "123456789B01")

        pdfS.FormFlattening = False
        pdfS.Close()


Dinand Veldman wrote:
> 
> FYI, I'm using the iTextSharp library from VB.net
> 
> 
> Dinand Veldman wrote:
>> 
>> Please forgive me, I can't figure out how to:
>> 
>> 1. Access the getField("<name>").display property - or -
>> 2. Execute the function ParticulierOfOndernemer
>> 
>> Any help would be appreciatet
>> 
>> 
>> Mark Storer-2 wrote:
>>> 
>>> Ah.  Here's the script for that radio button:
>>> ParticulierOfOndernemer();
>>> 
>>> 
>>> And in one of the document level scripts, the function itself:
>>> 
>>> function ParticulierOfOndernemer()
>>> {
>>>     checkwaarde = this.getField("ParticulierOfOndernemer").value;
>>>     if (checkwaarde == "Particulier") {
>>>     getField("BTWnummer").value = "";
>>>     getField("BTWnummer").display = display.hidden;
>>>     getField("BPMvergunning").value = "";
>>>     getField("BPMvergunning").display = display.hidden;
>>>     getField("BPMvergunningnummer").value = "";
>>>     getField("BPMvergunningnummer").display = display.hidden;
>>>     getField("BSNnummer").display = display.visible;
>>>     getField("BSNnummer").setFocus();
>>>     }
>>>     if (checkwaarde == "Ondernemer") {
>>>     getField("BSNnummer").value = "";
>>>     getField("BSNnummer").display = display.hidden;
>>>     getField("BPMvergunning").display = display.visible;
>>>     getField("BTWnummer").display = display.visible;
>>>     getField("BTWnummer").setFocus();
>>>     }
>>>     if (checkwaarde == "Off") {
>>>     getField("BSNnummer").value = "";
>>>     getField("BTWnummer").value = "";
>>>     getField("BPMvergunning").value = "";
>>>     getField("BPMvergunningnummer").value = "";
>>>     getField("BSNnummer").display = display.hidden;
>>>     getField("BTWnummer").display = display.hidden;
>>>     getField("BPMvergunning").display = display.hidden;
>>>     getField("BPMvergunningnummer").display = display.hidden;
>>> 
>>>     }
>>> }
>>> 
>>> You should be able to duplicate the effects of this script using
>>> iTextSharp.  I don't see any document or page events that would trigger
>>> this or other similar functions in the document, but I still suggest
>>> setting the appropriate radio group value for these fields so if the
>>> above function IS evaluated, it won't wipe your field values or hide the
>>> fields themselves.
>>> 
>>> --Mark Storer 
>>>   Senior Software Engineer 
>>>   Cardiff.com
>>> 
>>> #include <disclaimer> 
>>> typedef std::Disclaimer<Cardiff> DisCard; 
>>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Dinand Veldman [mailto:[email protected]]
>>>> Sent: Monday, January 11, 2010 10:56 AM
>>>> To: [email protected]
>>>> Subject: Re: [iText-questions] Enable Conditional Textfield 
>>>> when filling
>>>> out form
>>>> 
>>>> 
>>>> 
>>>> Sample form is in the attachment. It is in Dutch. There's a checkbox
>>>> "ParticulierOfOndernemer" with states 
>>>> ("Particulier","Ondernemer"). When
>>>> state is set to "Particulier" textfield "BSNnummer" should be filled,
>>>> otherwise textfield "BTWnummer".
>>>> 
>>>> As I said, the value I assigned to BTWnummer is saved with 
>>>> the form, but
>>>> when you open it using Adobe Reader it isn't visible.
>>>> 
>>>> Here's the code I use (VB.Net with iTextSharp library):
>>>> 
>>>>         pdfR = New PdfReader("f:\aangifte_bpm_2010.pdf")
>>>>         pdfS = New PdfStamper(pdfR, New
>>>> IO.FileStream("f:\temp\test_bpm_aangifte.pdf", _
>>>>         IO.FileMode.Create))
>>>>         Dim form As AcroFields = pdfS.AcroFields
>>>> 
>>>>         form.SetField("Naam", TextBox2.Text)
>>>>         form.SetField("Adres", TextBox3.Text)
>>>>         form.SetField("ParticulierOfOndernemer", "Ondernemer")
>>>>         form.SetField("BTWnummer", "123456789B01", "123456789B01")
>>>>         pdfS.FormFlattening = False
>>>>         pdfS.Close()
>>>> 
>>>> Users have to fill out the form and sent/hand in a printed 
>>>> copy to the tax
>>>> authorities
>>>> 
>>>> http://old.nabble.com/file/p27115722/aangifte_bpm_2010.pdf
>>>> aangifte_bpm_2010.pdf 
>>>> 
>>>> 
>>>> Leonard Rosenthol-3 wrote:
>>>> > 
>>>> > Can you post a sample form which demonstrates the problem?
>>>> > 
>>>> > And do you know what technology/product is being used to 
>>>> read values on
>>>> > their end?
>>>> > 
>>>> > -----Original Message-----
>>>> > From: Dinand Veldman [mailto:[email protected]] 
>>>> > Sent: Monday, January 11, 2010 12:34 PM
>>>> > To: [email protected]
>>>> > Subject: Re: [iText-questions] Enable Conditional Textfield 
>>>> when filling
>>>> > out form
>>>> > 
>>>> > 
>>>> > It's AcroForm technology.
>>>> > 
>>>> > I've tried several approaches, but the value I've assigned 
>>>> doesn't appear,
>>>> > although it is in the document (I can read it programmatically).
>>>> > 
>>>> > What actions has a CheckBox?
>>>> > 
>>>> > Dinand
>>>> > 
>>>> > 
>>>> > 1T3XT info wrote:
>>>> >> 
>>>> >> Dinand Veldman wrote:
>>>> >>> Hi, I want to fill out a form of the Dutch Tax Authorities 
>>>> >>> (belastingdienst). They put checkboxes in their PDf forms 
>>>> which directs 
>>>> >>> you to certain field (most textboxes) I'm able to fill 
>>>> out the normal 
>>>> >>> textboxes and set the correct checkbox choices, but I 
>>>> can't fill out the 
>>>> >>> textboxes that depend on the checkboxes choices. How 
>>>> should I proceed?
>>>> >> 
>>>> >> The first thing we should know is:
>>>> >> 
>>>> >> what technology is used for the form: AcroForm or XFA 
>>>> technology (or XFA 
>>>> >> with an AcroForm counterpart).
>>>> >> 
>>>> >> If it's AcroForm technology, you should see the check 
>>>> boxes if you list 
>>>> >> the fields in the form. I guess that there's some 
>>>> JavaScript that is 
>>>> >> executed if an end user clicks a field; when you fill out 
>>>> the field 
>>>> >> using iText, the JavaScript isn't executed (because iText 
>>>> ignores the 
>>>> >> JavaScript; it just changes some entries in the field dictionary).
>>>> >> 
>>>> >> ....
>>>> >> 
>>>> >> 
>>>> > 
>>>> > -- 
>>>> > View this message in context:
>>>> > 
>>>> http://old.nabble.com/Enable-Conditional-Textfield-when-fillin
>>>> g-out-form-tp27108102p27114349.html
>>>> > Sent from the iText - General mailing list archive at Nabble.com.
>>>> > 
>>>> > 
>>>> > 
>>>> --------------------------------------------------------------
>>>> ----------------
>>>> > This SF.Net email is sponsored by the Verizon Developer Community
>>>> > Take advantage of Verizon's best-in-class app development support
>>>> > A streamlined, 14 day to market process makes app 
>>>> distribution fast and
>>>> > easy
>>>> > Join now and get one step closer to millions of Verizon customers
>>>> > http://p.sf.net/sfu/verizon-dev2dev 
>>>> > _______________________________________________
>>>> > 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
>>>> > 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/
>>>> > 
>>>> > 
>>>> --------------------------------------------------------------
>>>> ----------------
>>>> > This SF.Net email is sponsored by the Verizon Developer Community
>>>> > Take advantage of Verizon's best-in-class app development support
>>>> > A streamlined, 14 day to market process makes app 
>>>> distribution fast and
>>>> > easy
>>>> > Join now and get one step closer to millions of Verizon customers
>>>> > http://p.sf.net/sfu/verizon-dev2dev 
>>>> > _______________________________________________
>>>> > 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
>>>> > 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/
>>>> > 
>>>> > 
>>>> 
>>>> -- 
>>>> View this message in context: 
>>> http://old.nabble.com/Enable-Conditional-Textfield-when-filling-out-form-tp27108102p27115722.html
>>> Sent from the iText - General mailing list archive at Nabble.com.
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support
>>> A streamlined, 14 day to market process makes app distribution fast and
>>> easy
>>> Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev 
>>> _______________________________________________
>>> 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
>>> 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/
>>> 
>>> ------------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Verizon Developer Community
>>> Take advantage of Verizon's best-in-class app development support
>>> A streamlined, 14 day to market process makes app distribution fast and
>>> easy
>>> Join now and get one step closer to millions of Verizon customers
>>> http://p.sf.net/sfu/verizon-dev2dev 
>>> _______________________________________________
>>> 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
>>> 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/
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Enable-Conditional-Textfield-when-filling-out-form-tp27108102p27124047.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
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
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/

Reply via email to