Hi,

 I need to change the submit action of a button added to pdf file.
But I have a problem, the action is null and I can figure out why or what is
the reason of it.

My code is the following:

   1.                  final PushbuttonField submitBtn = createSubmitButton(
   stamper); //Creating a submit button
   2.                  final PdfAction action = PdfAction.createSubmitForm(
   getRequestUrl(), //Creating the action
   3.                                  null, PdfAction.SUBMIT_HTML_FORMAT
   4.                                                  | PdfAction.
   SUBMIT_COORDINATES);
   5.                  final PdfFormField field =
submitBtn.getField(); //Getting
   the field
   6.                  field.setAction(action); //Adding the new action
   7.
   8.                  final AcroFields form =
stamper.getAcroFields(); //Getting
   the fields
   9.                  final AcroFields.Item f = form.getFieldItem(
   "wicket-submit-button"); // Get the item from the pdf which will be
   edited
   10.                  final PRIndirectReference ref  = (
   PRIndirectReference) f.getWidgetRef(0); //Getting a ref
   11.                  final PdfDictionary object = (PdfDictionary)stamper.
   getReader().getPdfObject(ref.getNumber());
   12.  //              final PdfDictionary acon = (PdfDictionary)
   object.get(PdfName.A);
   13.                  final PdfDictionary acon = (PdfDictionary) object.
   get(PdfName.ACTION); //Getting the action
   14.
   15.                  final PdfDictionary file = (PdfDictionary) acon.get(
   PdfName.F); //
   16.                  file.put(PdfName.F, submitBtn.getField()); //Overriding
   the field
   17.

   Any Idea why does not work?


-- 
(
 )
[_]D

Fausto A. Bencosme D.
Software Developer
KindleIT.net S.R.L

e: [email protected]
c: (809) 923-0123
t:  (809) 569-3835
o: (849) 936-0300
g: (972) 616-3197




-- 
(
 )
[_]D

Fausto A. Bencosme D.
Software Developer
KindleIT.net S.R.L

e: [email protected]
c: (809) 923-0123
t:  (809) 569-3835
o: (849) 936-0300
g: (972) 616-3197
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
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