Op 9/03/2011 12:57, Marks Nkosi schreef:
> Hi, How can I an iTextPDF form with Three Multiple drop down list e.g 
> country, state and city in a java project? When selecting country all 
> related states to the country must appear, and all the cities for that 
> state must also appear. Thanks

You have three options. They all involve JavaScript.

(1.) You store all the countries, states and cities in the PDF as 
JavaScript arrays.
You use JavaScript embedded in the PDF to change the content of the drop 
down list boxes.
This is the recommended solution: it will always work, unless the end 
user has turned off JavaScript.

(2.) You establish a communication with a server. This is tricky, 
because JavaScript in PDF has strict security policies: having a 
document communicate with a server can be seen as a security hazard.
How can you establish a communication with a server?
(a) by embedding the PDF as an object in an HTML page. A change in a 
drop down list in the PDF could trigger a JavaScript method in the HTML; 
the HTML could fetch the data needed, and pass it to a JavaScript method 
in the PDF so that another list is filled.
Consequences: you can't use the PDF in a standalone PDF viewer, only in 
a browser. This won't work for all browsers on all operating systems.
(b) by embedding a Flash component in the PDF. A change in a drop down 
list in the PDF could trigger an ActionScript method in the SWF; the SWF 
could fetch the data needed, and pass it to a JavaScript method in the 
PDF so that another list is filled.
Consequences: you'll have to write a custom Flash/Flex app to create the 
SWF; this will only work in the most recent versions of Adobe Reader; 
end users will get plenty of "Allow or Block" dialog boxes.

(3.) Create a new PDF for every step. If the end user selects a country 
in a web app, submit the country to the server, and create a new PDF 
with the states, and so on.
Consequences: this will only work in a web app.

Note that iText isn't mentioned in these answers: you're asking 
something that is not done in PDF.



------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to