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





Reply via email to