ArrayList objArrayList = objItem.widgets;
PdfDictionary dic = (PdfDictionary)objArrayList.get(0);
PdfDictionary action =
(PdfDictionary)PdfReader.getPdfObject(dic.get(PdfName.A));
action.put(PdfName.URI, new PdfString("http://mysite/go";));

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Nitin Tomer
> Sent: Tuesday, January 17, 2006 6:37 AM
> To: [email protected]
> Subject: [iText-questions] Changing Submit-Action of a 
> PushButton in a PDF Form
> 
> Hi,
>         I need to change the Submit-Action (the URL) of a 
> push-button in an 
> AcroForm programmatically. I got all the fields of the form 
> in an AcroField 
> object; and then traversed the fileds to looks for the 
> PushButton type 
> field. Then for the push-button filed I got the ArrayList 
> widgets from 
> AcroFields.Item. Following the code I used to traverse thru 
> this ArrayList-
> 
>       ArrayList objArrayList = objItem.widgets;
>       Iterator iter1 = objArrayList.iterator(),iter2;
>       String strName;
>       PdfDictionary objPdfDict = null;
>       PdfName objName = null;
>       PdfObject objObject = null;
>       while(iter1.hasNext())
>       {
>        objPdfDict = (PdfDictionary)iter1.next();
>        System.out.println("PdfDictionary Object: " + 
> objPdfDict.toString());
>        Set objSet = objPdfDict.getKeys();
>        for(iter2 = objSet.iterator(); iter2.hasNext();)
>        {
>         objName = (PdfName)iter2.next();
>         objObject = objPdfDict.get(objName);
>         System.out.println("objName: " + objName.toString() + 
> " - objObject: 
> " + objObject.toString() + " - Type: " + objObject.type());
>         if(objObject.isDictionary())
>         {
>          Set objSet2 = ((PdfDictionary)objObject).getKeys();
>          PdfObject objObject2;
>          PdfName objName2;
>          for(Iterator iter3 = objSet2.iterator(); iter3.hasNext();)
>          {
>           objName2 = (PdfName)iter3.next();
>           objObject2 = ((PdfDictionary)objObject).get(objName2);
>           System.out.println("objName2: " + objName2.toString() + " - 
> objObject2: " + objObject2.toString() + " - Type: " + 
> objObject2.type());
>          }
>         }
>        }
>       }
> 
> The output is -
> 
> PdfDictionary Object: [EMAIL PROTECTED]
> objName: /AP - objObject: 
> [EMAIL PROTECTED] - Type: 
> 6
> objName2: /D - objObject2: 
> [EMAIL PROTECTED] - 
> Type: 10
> objName2: /N - objObject2: 
> [EMAIL PROTECTED] - 
> Type: 10
> objName: /MK - objObject: 
> [EMAIL PROTECTED] - Type: 
> 6
> objName2: /CA - objObject2: Submit - Type: 3
> objName2: /BG - objObject2: 
> [EMAIL PROTECTED] - Type: 5
> objName2: /BC - objObject2: 
> [EMAIL PROTECTED] - Type: 5
> objName: /P - objObject: 
> [EMAIL PROTECTED] - 
> Type: 10
> objName: /Parent - objObject: 
> [EMAIL PROTECTED] - Type: 10
> objName: /H - objObject: /P - Type: 4
> objName: /F - objObject: 4 - Type: 2
> objName: /BS - objObject: 
> [EMAIL PROTECTED] - Type: 6
> objName2: /W - objObject2: 2 - Type: 2
> objName2: /S - objObject2: /B - Type: 4
> objName: /Subtype - objObject: /Widget - Type: 4
> objName: /A - objObject: 
> [EMAIL PROTECTED] - 
> Type: 10
> objName: /Type - objObject: /Annot - Type: 4
> objName: /Rect - objObject: 
> [EMAIL PROTECTED] - Type: 5
> 
> Please give some inputs on how to change the submit-action 
> URL. I am stuck 
> and not able to move forward.
> 
> Thanx and Regards
> 
> Nitin
> 
> 
> 
> Disclaimer :- This e-mail message including any attachment 
> may contain confidential, proprietary or legally privileged 
> information. It should not be used by who is not the original 
> intended recipient. If you have erroneously received this 
> message, you are notified that you are strictly prohibited 
> from using, coping, altering or disclosing the content of 
> this message. Please delete it immediately and notify the 
> sender. Newgen Software Technologies Ltd and / or its 
> subsidiary Companies accept no responsibility for loss or 
> damage arising from the use of the information transmitted by 
> this email including damage from virus and further 
> acknowledges that any views expressed in this message are 
> those of the individual sender and no binding nature of the 
> message shall be implied or assumed unlessthe sender does so 
> expressly with due authority of Newgen Software 
> TechnologiesLtd and / or its subsidiary Companies, as applicable.
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep 
> through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  
> DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&;
> dat=121642
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to