All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.redsix.pdfcompare.PageExclusions Maven / Gradle / Ivy

Go to download

A simple Java library to compare two PDF files. Files are rendered and compared pixel by pixel.

There is a newer version: 1.2.3
Show newest version
package de.redsix.pdfcompare;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;

public class PageExclusions {

    private final Collection exclusions = new ArrayList<>();
    private final PageExclusions delegate;

    public PageExclusions() {
        delegate = null;
    }

    public PageExclusions(final PageExclusions delegate) {
        this.delegate = delegate;
    }

    public void add(final PageArea exclusion) {
        exclusions.add(exclusion);
    }

    public boolean contains(final int x, final int y) {
        for (PageArea exclusion : exclusions) {
            if (exclusion.contains(x, y)) {
                return true;
            }
        }
        if (delegate != null) {
            return delegate.contains(x, y);
        }
        return false;
    }

    public void forEach(final Consumer exclusionConsumer) {
        exclusions.forEach(exclusionConsumer);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy