Gawędzki wrote:
> I have pdf document with text fields, radio buttons and checkboxes.

OK, just like:
http://1t3xt.info/examples/results/in_action/chapter16/register_form1.pdf

> Those fields has names from xml file (ex. radio button is named "//ProductId"

In my case for instance "person.preferred"

> and contains name of the products: a, b, c and d).

In my case EN, FR, NL.

> I need to create an application that takes from radio button name
> of the product (in my case a, b, c or d)

In my case form.getField("person.preferred");

> and put in to xml in xpath equal to radio button name.

I don't understand the above, but I read on in the hope that
I'll understand the context.

> I need this because my task is to create software which
> let me build xml file an put some data into it.

So you need to build an XML file based on the values
entered in a PDF document. OK, I'm still with you.

> It looks like this
> 
> Radio button named //ProductId
> *     'a' on-value, 'off' off-value
> *     'b' on-value, 'off' off-value
> *     'c' on-value, 'off' off-value
> *     'd' on-value, 'off' off-value

That's different from what I understood when I read your
original question. Your pretended it was:
Radio button named //ProductId
* product a 'on' on-value, 'off' off-value
* product b 'on' on-value, 'off' off-value
* product c 'on' on-value, 'off' off-value
* product d 'on' on-value, 'off' off-value
I'm happy for you that this isn't the case.

> I choose product 'b' so it looks like this:
> Radio button named //ProductId
> *     'off'
> *     'b'
> *     'off'
> *     'off'

OK.
In my example, I have:
* EN
* Off
* Off
This is the value chosen in an EXISTING PDF file.
One that is filled in and saved.

> I want to check radio button  and take from it value 'b'

In my case form.getField("person.preferred");
This will return "EN".
Note that this was my original answer (12:20).
In your case getField will return "b".
(Have you actually tried this?)

> and put into xml file in exact place:
> <ProductId>b</ProductId>

OK,
in my case I would produce something like
<person>
        ...
        <language>FR</language>
        <preferred>EN</preferred>
        <knowledge>
                <English>Yes</English>
                <French>Yes</French>
                <Dutch>No</Dutch>
        </knowledge>
        ...
</person>
Just to make sure: we aren't talking about XFDF, are we?
We are just talking about XML you are creating yourself.

> I do not know how to do that and if it's possible with iText.

What is the question? This works!

> I need name of the product because I have to know what path I have to choose.

But you HAVE the name of the product if you use the getField method...

Of course, suppose that you have a similar form like mine:
English [ ]
French  [ ]
Dutch   [ ]
With [ ] the widgets of the radio buttons corresponding with the
values "EN", "FR", and "NL", then you WILL NEVER be able to know
that "English" corresponds with "EN", "French" with "FR" and
"Dutch" with "NL", unless you have this information elsewhere.

Is that your problem? Because if it isn't, you are frustrating me.
I keep on repeating the same answer because IT IS the answer
to your question, but you keep on ASKING THE SAME QUESTION.

> If you have a different, better or wars solution you can write
> to me but I would rather you helped me with this one ?

I would rather you READ this answer AND CLEARLY INDICATE what
you don't understand in my answer.
br,
Bruno

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to