You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by clovis <cl...@gmail.com> on 2016/01/21 13:27:03 UTC

Add a Submit Action to PDPushButton

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

Re: Add a Submit Action to PDPushButton

Posted by clovis <cl...@gmail.com>.
Ok thanks for the responses. I know this is beyound this forum's scope. But
I think people here can make good suggestions about this topic and if the
solution happens to be returning FDF, I think I will need your help again
in dealing with this response.

I will try both PDF or FDF. As HTML seems very ugly for me (if it will
always open a new default browser window).

Clóvis



2016-01-21 11:26 GMT-02:00 Maruan Sahyoun <sa...@fileaffairs.de>:

> and FDF is supported too as has been pointed out.
>
> Maruan Sahyoun
>
> > Am 21.01.2016 um 14:24 schrieb Maruan Sahyoun <sa...@fileaffairs.de>:
> >
> > For Adobe Reader you need to supply a PDF als the response content.
> Adobe Acrobat also supports other response formats auch aus HTML.
> >
> > BR
> >
> > Maruan Sahyoun
> >
> >> Am 21.01.2016 um 14:08 schrieb clovis <cl...@gmail.com>:
> >>
> >> Sorry, I've just tested again and it is working now. Actualy it was
> already.
> >> The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
> >> Reader shows a message immediatly after you click the button.
> >> The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't
> show
> >> any feedback until some time, I have closed it before that time and I
> >> thought it was wrong.
> >> I set up a web page on that URL and it now opens a web browser with the
> >> resulting page.
> >> Now I have an unforeseen problem.
> >> How to make Acrobat Reader to handle the response? Or which is the best
> >> aproach (from user perspective) if the behavior is to always save the
> >> response in a temp folder and open it in the default browser?
> >>
> >> Clóvis
> >>
> >>
> >> 2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:
> >>
> >>> Hi,
> >>>
> >>> The screenshot didn't get through. Please upload it somewhere, also the
> >>> PDF you created with Adobe. Please do also post your current code in
> full.
> >>>
> >>> Tilman
> >>>
> >>>> Am 21.01.2016 um 13:27 schrieb clovis:
> >>>>
> >>>> 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):
> >>>>
> >>>> 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
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> > For additional commands, e-mail: users-help@pdfbox.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Add a Submit Action to PDPushButton

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
and FDF is supported too as has been pointed out.

Maruan Sahyoun

> Am 21.01.2016 um 14:24 schrieb Maruan Sahyoun <sa...@fileaffairs.de>:
> 
> For Adobe Reader you need to supply a PDF als the response content. Adobe Acrobat also supports other response formats auch aus HTML.
> 
> BR
> 
> Maruan Sahyoun
> 
>> Am 21.01.2016 um 14:08 schrieb clovis <cl...@gmail.com>:
>> 
>> Sorry, I've just tested again and it is working now. Actualy it was already.
>> The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
>> Reader shows a message immediatly after you click the button.
>> The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't show
>> any feedback until some time, I have closed it before that time and I
>> thought it was wrong.
>> I set up a web page on that URL and it now opens a web browser with the
>> resulting page.
>> Now I have an unforeseen problem.
>> How to make Acrobat Reader to handle the response? Or which is the best
>> aproach (from user perspective) if the behavior is to always save the
>> response in a temp folder and open it in the default browser?
>> 
>> Clóvis
>> 
>> 
>> 2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:
>> 
>>> Hi,
>>> 
>>> The screenshot didn't get through. Please upload it somewhere, also the
>>> PDF you created with Adobe. Please do also post your current code in full.
>>> 
>>> Tilman
>>> 
>>>> Am 21.01.2016 um 13:27 schrieb clovis:
>>>> 
>>>> 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):
>>>> 
>>>> 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Add a Submit Action to PDPushButton

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
For Adobe Reader you need to supply a PDF als the response content. Adobe Acrobat also supports other response formats auch aus HTML.

BR

Maruan Sahyoun

> Am 21.01.2016 um 14:08 schrieb clovis <cl...@gmail.com>:
> 
> Sorry, I've just tested again and it is working now. Actualy it was already.
> The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
> Reader shows a message immediatly after you click the button.
> The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't show
> any feedback until some time, I have closed it before that time and I
> thought it was wrong.
> I set up a web page on that URL and it now opens a web browser with the
> resulting page.
> Now I have an unforeseen problem.
> How to make Acrobat Reader to handle the response? Or which is the best
> aproach (from user perspective) if the behavior is to always save the
> response in a temp folder and open it in the default browser?
> 
> Clóvis
> 
> 
> 2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:
> 
>> Hi,
>> 
>> The screenshot didn't get through. Please upload it somewhere, also the
>> PDF you created with Adobe. Please do also post your current code in full.
>> 
>> Tilman
>> 
>>> Am 21.01.2016 um 13:27 schrieb clovis:
>>> 
>>> 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):
>>> 
>>> 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
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Add a Submit Action to PDPushButton

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 21.01.2016 um 14:08 schrieb clovis:
> Sorry, I've just tested again and it is working now. Actualy it was already.
> The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
> Reader shows a message immediatly after you click the button.
> The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't show
> any feedback until some time, I have closed it before that time and I
> thought it was wrong.
> I set up a web page on that URL and it now opens a web browser with the
> resulting page.
> Now I have an unforeseen problem.
> How to make Acrobat Reader to handle the response? Or which is the best
> aproach (from user perspective) if the behavior is to always save the
> response in a temp folder and open it in the default browser?

All I could find is this in 12.7.7 Forms Data Format:

This sub-clause describes Forms Data Format (FDF), the file format used 
for interactive form data (PDF 1.2). FDF can be used when submitting 
form data to a server, receiving the response, and incorporating it into 
the interactive form.

Tilman



>
> Clóvis
>
>
> 2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:
>
>> Hi,
>>
>> The screenshot didn't get through. Please upload it somewhere, also the
>> PDF you created with Adobe. Please do also post your current code in full.
>>
>> Tilman
>>
>> Am 21.01.2016 um 13:27 schrieb clovis:
>>
>>> 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):
>>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Add a Submit Action to PDPushButton

Posted by Gilad Denneboom <gi...@gmail.com>.
This is beyond the scope of this forum, I think, but you could return a
simple FDF file from your service.
The file will be processed by the application and presented to the user.

On Thu, Jan 21, 2016 at 2:08 PM, clovis <cl...@gmail.com> wrote:

> Sorry, I've just tested again and it is working now. Actualy it was
> already.
> The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
> Reader shows a message immediatly after you click the button.
> The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't show
> any feedback until some time, I have closed it before that time and I
> thought it was wrong.
> I set up a web page on that URL and it now opens a web browser with the
> resulting page.
> Now I have an unforeseen problem.
> How to make Acrobat Reader to handle the response? Or which is the best
> aproach (from user perspective) if the behavior is to always save the
> response in a temp folder and open it in the default browser?
>
> Clóvis
>
>
> 2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:
>
> > Hi,
> >
> > The screenshot didn't get through. Please upload it somewhere, also the
> > PDF you created with Adobe. Please do also post your current code in
> full.
> >
> > Tilman
> >
> > Am 21.01.2016 um 13:27 schrieb clovis:
> >
> >> 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):
> >>
> >> 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
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
>

Re: Add a Submit Action to PDPushButton

Posted by clovis <cl...@gmail.com>.
Sorry, I've just tested again and it is working now. Actualy it was already.
The test PDF I created with Acrobat Pro has an invalid URL and Acrobat
Reader shows a message immediatly after you click the button.
The PDF I've created with PDFBOX has a valid URL and Acrobat doesn't show
any feedback until some time, I have closed it before that time and I
thought it was wrong.
I set up a web page on that URL and it now opens a web browser with the
resulting page.
Now I have an unforeseen problem.
How to make Acrobat Reader to handle the response? Or which is the best
aproach (from user perspective) if the behavior is to always save the
response in a temp folder and open it in the default browser?

Clóvis


2016-01-21 10:50 GMT-02:00 Tilman Hausherr <TH...@t-online.de>:

> Hi,
>
> The screenshot didn't get through. Please upload it somewhere, also the
> PDF you created with Adobe. Please do also post your current code in full.
>
> Tilman
>
> Am 21.01.2016 um 13:27 schrieb clovis:
>
>> 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):
>>
>> 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
>>
>>
>>
>>
>>
>>
>>
>

Re: Add a Submit Action to PDPushButton

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

The screenshot didn't get through. Please upload it somewhere, also the 
PDF you created with Adobe. Please do also post your current code in full.

Tilman

Am 21.01.2016 um 13:27 schrieb clovis:
> 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):
>
> 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
>
>
>
>
>
>