pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clovis <clovis.har...@gmail.com>
Subject Re: Add a Submit Action to PDPushButton
Date Thu, 21 Jan 2016 13:08:23 GMT
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?


2016-01-21 10:50 GMT-02:00 Tilman Hausherr <THausherr@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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message