Hi,
i expanded on the solution posted by Paulo earlier:
> Try:
>
> ArrayList objArrayList = objItem.widgets;
> PdfDictionary dic = (PdfDictionary)objArrayList.get(0);
> PdfDictionary action =
> (PdfDictionary)PdfReader.getPdfObject(dic.get(PdfName.A));
> PdfDictionary f =
> (PdfDictionary)PdfReader.getPdfObject(action.get(PdfName.F));
> f.put(PdfName.F, new PdfString("http://mysite/go"));
My problem is that 'action' as in the code above is null on my button though
it submits to the url i original entered in acrobat designer. I changed the
above code to the following:
int type = fields.getFieldType(fieldName);
if (AcroFields.FIELD_TYPE_PUSHBUTTON == type
&& values.containsKey(SUBMIT_URL)) {
AcroFields.Item objItem = (AcroFields.Item) fieldMap
.get(fieldName);
ArrayList objArrayList = objItem.widgets;
PdfDictionary dic = (PdfDictionary) objArrayList.get(0);
PdfDictionary action = (PdfDictionary) PdfReader
.getPdfObject(dic.get(PdfName.A));
if (action == null) {
action = new PdfDictionary();
dic.put(PdfName.A, action);
}
PdfDictionary f = (PdfDictionary)
PdfReader.getPdfObject(action
.get(PdfName.F));
if (f == null) {
f = new PdfDictionary();
action.put(PdfName.F, f);
}
f.put(PdfName.F, new PdfString(values.get(SUBMIT_URL)));
}
Where fieldName ist the name of the filed obtained from the keys of the map
returned by AcroForm.getFields() and values is a map used to fill fields
from.
Since the 'action' object is null i create a new one and put it in the
dictionary dic. The same for 'f'. What do i do wrong here? Do i create an
illegal dictionary?
The reusulting document still commits to the url entered originally.
regards
Dirk
--
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl
-------------------------------------------------------
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