Example usage for org.apache.pdfbox.pdmodel.interactive.form PDTextField setValue

List of usage examples for org.apache.pdfbox.pdmodel.interactive.form PDTextField setValue

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.form PDTextField setValue.

Prototype

@Override
public void setValue(String value) throws IOException 

Source Link

Document

Set the plain text value of this field, and try to update the visual appearance.

Usage

From source file:fi.riista.feature.permit.invoice.pdf.PermitHarvestInvoicePdfBuilder.java

private void textField(final String fieldName, final String value) throws IOException {
    final PDField field = acroForm.getField(fieldName);

    if (field instanceof PDTextField) {
        final PDTextField textField = (PDTextField) field;
        textField.setValue(value);
        textField.setReadOnly(true);//from  w ww.j  a va 2  s .com
    } else {
        throw new IllegalArgumentException("No such field " + fieldName);
    }
}