|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Quad defines a public interface for obtaining the location and orientation of one or more characters in a word. The interface supports data extraction and text positioning. It also enables custom applications to highlight the static text in a PDF document.
The getQuadList method of a PDFWord object returns a list of Quad objects. Each Quad object is associated with a set of four corner points: p1, p2, p3, and p4. The points represent the corners of a bounding quadrilateral that defines the area occupied by one or more characters. If the characters are aligned to a path, the points indicate the orientation of the characters along the path.
When the word is not rotated, corner point p1 defines the lower left corner of one or more characters, point p2 defines the lower right corner, p3 defines the upper right corner, and p4 defines the upper left corner. If the word were rotated 180°, p1 would be in the upper right corner and p3 would be in the lower left corner.

You can use the methods described in this chapter to get the locations of points p1, p2, p3, and p4. The following example shows how to get the locations:
//Iterate over every word in the PDF document.
ListIterator words = pdfDocument.getWords();
while (words.hasNext())
{
PDFWord word = (PDFWord)words.next();
//Iterate over every Quad object in the list.
ListIterator quads = word.getQuadList();
while (quads.hasNext())
{
Quad quad = (Quad)quads.next();
//Get the point locations.
Point p1, p2, p3, p4;
p1 = quad.p1();
p2 = quad.p2();
p3 = quad.p3();
p4 = quad.p4();
}
}
PDFWord| Method Summary | |
Point |
p1()
Gets the lower left corner of the bounding quadrilateral. |
Point |
p2()
Gets the lower right corner of the bounding quadrilateral. |
Point |
p3()
Gets the upper right corner of the bounding quadrilateral. |
Point |
p4()
Gets the upper left corner of the bounding quadrilateral. |
| Method Detail |
public Point p1()
Pointpublic Point p2()
Pointpublic Point p3()
Pointpublic Point p4()
Point
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||