Problem setting textfield value

  • Ronald

    Ronald - 2010-01-20

    setting textfield value of a form in diffrent version of adobe reader got some problem.

    Some version do not show the value that is set on the textfield. Why is this happening and what should we do to make it show in any version of adobe reader or any pdf readers.

    Can you give me snippets?

    I've tried textField.setFieldString(PDAFTextField.DK_RV , fieldValue);
    nothing happens..

    for combo box field I've use this fieldChoice.setFieldString(PDAFChoiceField.DK_I, fieldValue);  and It worked!! but how about with the textfield..

    Hope for immediate response..

  • mtraut

    mtraut - 2010-01-20

    The PDF spec separates a fields value and a fields visual "apperance".

    The viewer should create an appearance dynamically if PDAcroForm.isNeedAppearances is true and no appearance is available with the annotation.

    You can create an appearance yourself to ensure the viewer has something to display. Appearance creation (PDFOrms containing content streams) can for example be done using the CSCreator framework. You can get a good understanding of what must be done when filling fields if you use and examine the StandardFormHandler.

    This will get even more complicated when you deal with forms containing XFA data structures. The XFA content will override any AcroForm content.

    I do not know what exactly is your scenario but setting "needAppearances" or adding an appearance will most probably do the job. I hope Reader 9 will still adhere to this conventions.

  • Ronald

    Ronald - 2010-01-21

    I have tried needAppearances last time. I know that it will now view the textfield value.

    But the forms is not saveable anymore.. that's the problem with it.. It makes the form readable and not saveable..

  • mtraut

    mtraut - 2010-01-21

    "needAppearances" has nothing to do with the save process.

    What application can not save your form?

    Is it possible that you manipulate a PDF document created with Adobe lifecycle designer - these have digital signatures to detect changes in the PDF structure (NOT in form content) and disable some features in Adobe Reader. In this case you can only go and create an appearance yourself.

  • Ronald

    Ronald - 2010-01-22

    Can you give me an example on how to create appearance of a form text field.. so that i can have an idea on how to do it?

  • mtraut

    mtraut - 2010-01-26

    I'm sorry i can't provide you with a complete example at the moment.

    Basic examples for dealing with content you can find in the package "de.intarsys.pdf.example.content".

    The basic course for creating widget appearances is documented in the PDF spec:

    - find the annotation
    - get / create the appearance dict
    - set the form with the respective content in the appropriate appearance state.
    - be sure to have correct bounding boxes and transformations


Log in to post a comment.