Example usage for org.apache.pdfbox.pdmodel.interactive.form PDNonTerminalField getChildren

List of usage examples for org.apache.pdfbox.pdmodel.interactive.form PDNonTerminalField getChildren

Introduction

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

Prototype

public List<PDField> getChildren() 

Source Link

Document

Returns this field's children.

Usage

From source file:com.formkiq.core.service.generator.pdfbox.PdfEditorServiceImpl.java

License:Apache License

/**
 * Add Field to Page Map./*from  w  ww  .j  a  v  a2s .  c  om*/
 *
 * @param objMap {@link Map} of {@link COSDictionary} objects by
 * Page Number.
 * @param field {@link PDField}
 * @param map {@link Map}
 * @throws IOException IOException
 */
private void addFieldToPageMap(final Map<COSDictionary, Integer> objMap, final PDField field,
        final Map<Integer, List<PDField>> map) throws IOException {

    List<PDAnnotationWidget> widgets = field.getWidgets();

    if (field instanceof PDNonTerminalField) {
        PDNonTerminalField tf = (PDNonTerminalField) field;

        for (PDField f : tf.getChildren()) {
            addFieldToPageMap(objMap, f, map);
        }

    } else {

        if (!CollectionUtils.isEmpty(widgets)) {

            LOG.log(Level.FINE, "addFieldToPageMap='" + field.getFullyQualifiedName() + "',class="
                    + field.getClass().getName());

            Integer page = getPageNumber(objMap, field);

            if (!map.containsKey(page)) {
                map.put(page, new ArrayList<>());
            }

            map.get(page).add(field);

        } else {

            LOG.log(Level.FINE, "skip addFieldToPageMap='" + field.getFullyQualifiedName() + "',class="
                    + field.getClass().getName());
        }
    }
}