Top Description Fields Constructors Methods
org.jabref.logic.pdf

public final Class TextExtractor

extends Object
Class Inheritance
Annotations
@AllowedToUseAwt:org.apache.pdfbox.text.PDFTextStripperByArea.addRegion uses AWT\'s Rectangle to indicate a region
Imports
java.awt.geom.Rectangle2D, java.io.IOException, java.util.Objects, org.jabref.architecture.AllowedToUseAwt, org.apache.pdfbox.cos.COSArray, org.apache.pdfbox.cos.COSFloat, org.apache.pdfbox.cos.COSInteger, org.apache.pdfbox.pdmodel.PDPage, org.apache.pdfbox.pdmodel.common.PDRectangle, org.apache.pdfbox.text.PDFTextStripperByArea

Extracts the text of marked annotations using bounding boxes.

Field Summary

Modifier and TypeField and Description
private final org.apache.pdfbox.cos.COSArray
private final org.apache.pdfbox.pdmodel.PDPage

Constructor Summary

AccessConstructor and Description
public
TextExtractor(org.apache.pdfbox.pdmodel.PDPage
the page the annotation is on, must not be null
page
,
org.apache.pdfbox.cos.COSArray
the raw annotation, must not be null
boundingBoxes
)

Method Summary

Modifier and TypeMethod and Description
private Rectangle2D
calculateSegmentBoundingBox(org.apache.pdfbox.cos.COSArray quadsArray, int segmentPointer)

public String

Returns:

The text of the annotation
extractMarkedText
()

Extracts the text of a marked annotation such as highlights, underlines, strikeouts etc.

private float
toFloat(Object cosNumber)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boundingBoxesback to summary
private final org.apache.pdfbox.cos.COSArray boundingBoxes
pageback to summary
private final org.apache.pdfbox.pdmodel.PDPage page

Constructor Detail

TextExtractorback to summary
public TextExtractor(org.apache.pdfbox.pdmodel.PDPage page, org.apache.pdfbox.cos.COSArray boundingBoxes)
Parameters
page:org.apache.pdfbox.pdmodel.PDPage

the page the annotation is on, must not be null

boundingBoxes:org.apache.pdfbox.cos.COSArray

the raw annotation, must not be null

Method Detail

calculateSegmentBoundingBoxback to summary
private Rectangle2D calculateSegmentBoundingBox(org.apache.pdfbox.cos.COSArray quadsArray, int segmentPointer)
extractMarkedTextback to summary
public String extractMarkedText() throws IOException

Extracts the text of a marked annotation such as highlights, underlines, strikeouts etc.

Returns:String

The text of the annotation

Exceptions
IOException:
If the PDFTextStripperByArea fails to initialize.
toFloatback to summary
private float toFloat(Object cosNumber)