Example usage for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotationWidget getCOSObject

List of usage examples for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotationWidget getCOSObject

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotationWidget getCOSObject.

Prototype

@Override
public COSDictionary getCOSObject() 

Source Link

Document

Interface method for COSObjectable.

Usage

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

License:Apache License

/**
 * Get Page Number for {@link PDField}./*from  w ww  .  j a  v a 2  s .c  o m*/
 * @param objMap {@link Map} of {@link COSDictionary} and Page Number
 * @param field {@link PDField}
 * @param widget {@link PDAnnotationWidget}
 * @return {@link Integer}
 */
private Integer getPageNumber(final Map<COSDictionary, Integer> objMap, final PDField field,
        final PDAnnotationWidget widget) {

    COSDictionary cosObject = widget.getCOSObject();

    if (objMap.containsKey(cosObject)) {
        return objMap.get(cosObject);
    }

    throw new PdfConversionException("cannot find page for " + field.getFullyQualifiedName());
}