List of usage examples for com.itextpdf.text.pdf.parser TextRenderInfo getAscentLine
public LineSegment getAscentLine()
From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java
License:Open Source License
/** * Checks if the text is inside render filter region. *//* w w w . j ava2 s. c o m*/ @Override public boolean allowText(TextRenderInfo renderInfo) { LineSegment ascent = renderInfo.getAscentLine(); LineSegment descent = renderInfo.getDescentLine(); Point2D[] glyphRect = new Point2D[] { new Point2D.Float(ascent.getStartPoint().get(0), ascent.getStartPoint().get(1)), new Point2D.Float(ascent.getEndPoint().get(0), ascent.getEndPoint().get(1)), new Point2D.Float(descent.getEndPoint().get(0), descent.getEndPoint().get(1)), new Point2D.Float(descent.getStartPoint().get(0), descent.getStartPoint().get(1)), }; for (Rectangle rectangle : rectangles) { Point2D[] redactRect = getVertices(rectangle); if (intersect(glyphRect, redactRect)) { return false; } } return true; }