Hi,

Now that my Push Button is visible.
I want to submit PDF or PDF form data to a server (unless someone knows how
to extract pdf form data just filled in a PDF embedded in an HTML page
using acrobat reader).

First I tried to use PDActionSubmitForm, but there is no
PDPushButton.setAction method similar to the "PDAnnotationLink.setAction".
And using AA does not worked.

//        PDActionSubmitForm pdactionsubmit = new PDActionSubmitForm();
//        pdactionsubmit.setFlags(256);
//        actions.setF(pdactionsubmit);
//        pb.setActions(actions);


Then I tried to insert the Action direct in the COSDictionary.

I have tried to mimic a sample form I have made with Acrobat Pro XI but
still does not submit.

Using PDFDebugger I can see the following tree (PDF generated with Acrobat
Pro, and my PDF on the right):

[image: Imagem inline 1]

I have just added the A node and annotation flags to the push button:

        PDPushButton pb = new PDPushButton(acroForm);
        pb.setPartialName("sbtn");
        COSDictionary cosPush = pb.getCOSObject();
        COSDictionary cosA = new COSDictionary();
        cosPush.setInt(COSName.F, 4);
        cosPush.setItem(COSName.A, cosA);
        cosPush.setItem(COSName.P, page);
        cosA.setInt(COSName.FLAGS, 256);
        cosA.setName(COSName.S, "SubmitForm");
        COSDictionary cosF = new COSDictionary();
        cosA.setItem(COSName.F, cosF);
        cosF.setString(COSName.F, "http://localhost:8080/docpres";);
        cosF.setName("FS", "URL");
        // add the field to the acroform
        acroForm.getFields().add(pb);


What else I need to do to make this button submit the form?

Clóvis

Reply via email to