Am 20.01.2016 um 23:01 schrieb clovis:
As I said I know nothing about the PDF file format.
So, this workaround will have to do. Now I have to make this button submit
the form.

I have a system where PDF designers make PDF templates. Some users fill
copies of those template and submit. My program processes those submited
PDF files and input the data into a database. This all works ok.
But now I want some users to fill and send form data directly from Acrobat
Reader without having to submit entire PDFs.
To do this I need to pre-process each PDF template with PDFBox and insert a
PushButton that submits form data to my site.
So, I think your workaround will be good enough because it is just to
create a temporary PDF for form submission.

Is this feasible?

If the people are working with Adobe Reader, yes.


I think now I just need to turn my Push Button into a Submit Button.

I think I have to create  a javascript on the PDF and associate with the
button, am I right?

I don't know enough about that one, I've never created a submit button PDF. Submit forms are explained in "12.7.5.2 Submit-Form Action" in the PDF specification. But feel free to ask specific questions if something is missing in the API or not working. (I'm already wondering whether the "Flags for submit-form actions" are included in PDFDebugger)

Tilman



Clóvis






2016-01-20 16:10 GMT-02:00 Tilman Hausherr <thaush...@t-online.de>:

Am 20.01.2016 um 18:43 schrieb clovis:

Thanks, it is working. Now I can see the button.
I need to understand this. I am a developer (java, c, .net, etc.) but I
do not know PDF format and I am new to PDFBox (used iText long ago).


The Javadocs states:

     public void setNeedAppearances(Boolean
     <
http://download.oracle.com/javase/1.6.0/docs/api/java/lang/Boolean.html?is-external=true>
value)

     Set the NeedAppearances value. *If this is false, *PDFBox will
     create appearances for all field widget.


Not only the creation of appearance streams isn't supported, the javadoc
is wrong too :-(


The javadoc does not say what happens if you set to TRUE.
You set to TRUE and the widget is visible, then I don't understand what
"appearances" is (and I think I don't understand differences between
appearances and widgets).
Also, the text field was already visibel (with border and background
colors).

The PDF spec tells this: "A flag specifying whether to construct
appearance streams and appearance dictionaries for all widget annotations
in the document". So it is set to tell Adobe to do it.

Of course this is really just a workaround. The real solution is to
construct the appearance stream yourself.

Tilman



Thanks again.

Clóvis


2016-01-20 14:12 GMT-02:00 Tilman Hausherr <thaush...@t-online.de
<mailto:thaush...@t-online.de>>:


     I can see the button by adding this line:

     acroForm.setNeedAppearances(true);

     alternatively, set the appearance stream yourself. This is similar
     to the code to which I posted the link earlier today (
     http://justpaste.it/CreateRadioButtons ). The stream is also to be
     in AP/N, here are the contents that Adobe sets after saving the file:

     0 0 1 rg
     0 0 100 20 re
     f
     0 0 1 RG
     0.5 0.5 99 19 re
     s
     q
       1 1 98 18 re
       W
       n
       0 g
       0 G
       BT
         /Helv 12.81 Tf
         0 g
         36.128 5.686 Td
         (teste) Tj
       ET
     Q







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

Reply via email to