Example usage for com.lowagie.text.pdf PdfFormField FF_MULTILINE

List of usage examples for com.lowagie.text.pdf PdfFormField FF_MULTILINE

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfFormField FF_MULTILINE.

Prototype

int FF_MULTILINE

To view the source code for com.lowagie.text.pdf PdfFormField FF_MULTILINE.

Click Source Link

Usage

From source file:org.squale.welcom.outils.pdf.advanced.WPdfFieldReader.java

License:Open Source License

/**
 * init//  w w w.j a  v  a  2s  .  c  om
 */
public void init() {
    for (int i = 0; i < pdfReader.getAcroForm().size(); i++) {

        final PRAcroForm.FieldInformation p = (PRAcroForm.FieldInformation) pdfReader.getAcroForm().getFields()
                .get(i);

        final WPdfField pf = new WPdfField();
        pf.setName(p.getName());

        // Si ce n'est pas un champs text alors on l'ignore
        if (!p.getInfo().contains(PdfName.FT)
                || !(((PdfName) p.getInfo().get(PdfName.FT)).toString().equals(PdfName.TX.toString()))) {
            pf.setType(WPdfFieldType.INCONNU);
        } else {
            if (p.getInfo().contains(PdfName.DV)) {
                pf.setDefaultValue(((PdfString) (p.getInfo().get(PdfName.DV))).toUnicodeString());
            }
            if (p.getInfo().contains(PdfName.V)) {
                pf.setValue(((PdfString) (p.getInfo().get(PdfName.V))).toUnicodeString());
            }
            if (p.getInfo().contains(PdfName.FF)) {
                final PdfNumber pn = (PdfNumber) p.getInfo().get(PdfName.FF);
                if ((pn.intValue() & PdfFormField.FF_MULTILINE) == PdfFormField.FF_MULTILINE) {
                    pf.setType(WPdfFieldType.MUTILINETEXT);
                } else {
                    pf.setType(WPdfFieldType.TEXT);
                }
            } else {
                pf.setType(WPdfFieldType.TEXT);
            }
        }
        fields.add(pf);
    }
}