use of com.itextpdf.kernel.colors.Color in project i7j-pdfsweep by itext.
the class PdfCleanUpTool method extractLocationsFromSingleRedactAnnotation.
/**
* Note: annotation can consist not only of one area specified by the RECT entry, but also of multiple areas specified
* by the QuadPoints entry in the annotation dictionary.
*/
private void extractLocationsFromSingleRedactAnnotation(PdfRedactAnnotation redactAnnotation) {
List<Rectangle> regions;
PdfArray quadPoints = redactAnnotation.getQuadPoints();
if (quadPoints != null && !quadPoints.isEmpty()) {
regions = translateQuadPointsToRectangles(quadPoints);
} else {
regions = new ArrayList<>();
regions.add(redactAnnotation.getRectangle().toRectangle());
}
redactAnnotations.put(redactAnnotation, regions);
int page = pdfDocument.getPageNumber(redactAnnotation.getPage());
Color cleanUpColor = redactAnnotation.getInteriorColor();
PdfDictionary ro = redactAnnotation.getRedactRolloverAppearance();
if (ro != null) {
cleanUpColor = null;
}
for (Rectangle region : regions) {
addCleanupLocation(new PdfCleanUpLocation(page, region, cleanUpColor));
}
}
use of com.itextpdf.kernel.colors.Color in project i7j-pdfsweep by itext.
the class CustomLocationExtractionStrategy method toRectangles.
@Override
public List<Rectangle> toRectangles(List<CharacterRenderInfo> cris) {
Color col = ((CCharacterRenderInfo) cris.get(0)).getFillColor();
List<Rectangle> rects = new ArrayList<>(super.toRectangles(cris));
for (Rectangle rect : rects) {
colorByRectangle.put(rect, col);
}
return rects;
}
Aggregations