> It was developped with LiveCycle Designer 8

LiveCycle-based forms are NOT AcroForms, they are XFA-Forms.  As such, trying 
to get the acroform from them, simply won't work....

To modify an XFA-based form, you need to load out the XFA (it's an XML stream) 
and process it using standard XML tools and then put it back.  There are 
samples online.

Leonard

-----Original Message-----
From: Martin Leboeuf [mailto:[email protected]] 
Sent: Wednesday, April 15, 2009 8:29 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] URL of submit button

Hi !

the form is attached. It was developped with LiveCycle Designer 8. Here is the 
code snippet from the servlet :


    File f = File.createTempFile("RequestForm", "pdf");
  
    ApplicationContext appCtx = BaseApplicationContext.getInstance();

    PdfReader reader = new 
PdfReader(appCtx.getResource("/download/RequestFormSequencageQC.pdf").openStream());
        
    PdfDictionary root = reader.getCatalog();
    PdfDictionary acroform = root.getAsDict(PdfName.ACROFORM);
    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(f));
    AcroFields form = stamper.getAcroFields();
    HashMap fields = form.getFields();
    AcroFields.Item field = (AcroFields.Item) 
fields.get("topmostSubform[0].Page3[0].Button3[0]");
    PRIndirectReference ref = (PRIndirectReference) 
field.widget_refs.iterator().next();
    PdfDictionary object = (PdfDictionary) reader.getPdfObject(ref.getNumber());
    PdfDictionary action = (PdfDictionary) object.get(PdfName.A);
    PdfDictionary file = (PdfDictionary) action.get(PdfName.F);
    file.put(PdfName.F, new PdfString("http://new url"));

As mentionned, "action" on the third to last line is null. Also, widget_refs is 
said to be deprecated. I use iText 2.1.5.

Many thanks,

Martin.

PS: I just bought the book and am eager to read it.

-----Message d'origine-----
De : 1T3XT info [mailto:[email protected]] Envoyé : Tuesday, April 14, 2009 12:56 
PM À : Post all your questions about iText here Objet : Re: [iText-questions] 
URL of submit button

[...]

What kind of form do you have? (AcroForm or XFA?) Is the button you're 
inspecting really the submit button?
Maybe seeing your form (the PDF file) would clarify things.

[...]


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to