-------------- Original message ----------------------
From: <[EMAIL PROTECTED]>
>
> Hi
>  
>   I have a requirement like this. I have a pdf with acro fields and
> submit button. on adding/changing values in acro fields user will press
> submit. this should call a webservice (WSDL call) and send the data as
> an XML. 

See Example 3 at http://segraves.tripod.com/index4.htm. This is an example, 
based on the SenderReceiver example in the book, in which a "Submit as XFDF" 
button has been added, among others.

Here's the code that generated the "Submit as XFDF" button:

                        PushbuttonField button3 = new PushbuttonField(writer,
                                        new Rectangle(325, 700, 425, 750), 
"Submit As XFDF");
                        button3.setBackgroundColor(Color.BLUE);
                        button3.setText("XFDF");
                        
button3.setOptions(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);
                        PdfFormField submit3 = button3.getField();
                        submit3.setAction(PdfAction.createSubmitForm(
                                                        
"http://segraves.tripod.com/cgi-bin/xfdf_echo.pl";, null,
                                        PdfAction.SUBMIT_XFDF));
                        writer.addAnnotation(submit3);

Now, recent versions of Adobe Reader do not support an Import Form Data action, 
so I used a Java Script to accomplish that. Here's the code for the 
corresponding button:


                        PushbuttonField button8 = new PushbuttonField(writer,
                                        new Rectangle(325, 600, 425, 650), 
"Import XFDF");
                        button8.setBackgroundColor(Color.GREEN);
                        button8.setText("Import XFDF");
                        
button8.setOptions(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);
                        PdfFormField importxfdf = button8.getField();
                        
importxfdf.setAction(PdfAction.javaScript("importAnXFDF('formdata.xfdf')", 
writer));
                        writer.addAnnotation(importxfdf);

The server-side script for the "Submit" action, reads the submit data on STDIN 
and sends it back to the client browser on STDOUT. I used a Perl script, but if 
you don't have Perl available, you should be able to craft a pretty short 
script to accomplish the required action, using the default behavior of "cat".


> I want to achieve this using iText 1.4.6. I tried to use
> pdfAction.createSubmitForm() but can't get a proper idea to make it
> through. 
> 

Why iText 1.4.6?

See above for ideas.
 
>   pls. help me how to achieve this. is there a reference for this in
> 'iText in Action' (though i searched and can't find something very
> specific)

Yes. See Chapter 15 in the book, as well as the documentation.

Best regards,
Bill Segraves

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
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