Search in sources :

Example 1 with ObjectPath

use of com.itextpdf.kernel.utils.objectpathitems.ObjectPath in project i7j-pdfsweep by itext.

the class CleanUpImagesCompareTool method initializeIgnoredObjectPath.

private void initializeIgnoredObjectPath(PageImageObjectsPaths cmpPageObjects, PageImageObjectsPaths outPageObjects) {
    try {
        List<PdfIndirectReference> cmpIndirects = cmpPageObjects.getIndirectReferences();
        List<PdfIndirectReference> outIndirects = outPageObjects.getIndirectReferences();
        PdfIndirectReference baseCmpIndirect = cmpIndirects.get(0);
        PdfIndirectReference baseOutIndirect = outIndirects.get(0);
        ObjectPath baseObjectPath = new ObjectPath(baseCmpIndirect, baseCmpIndirect);
        for (int i = 1; i < cmpIndirects.size(); i++) {
            baseObjectPath.resetDirectPath(cmpIndirects.get(i), outIndirects.get(i));
            baseCmpIndirect = cmpIndirects.get(i);
            baseOutIndirect = outIndirects.get(i);
        }
        for (Stack<LocalPathItem> path : cmpPageObjects.getDirectPaths()) {
            ignoredObjectPaths.add(new ObjectPath(baseCmpIndirect, baseOutIndirect, path, baseObjectPath.getIndirectPath()));
        }
    } catch (Exception e) {
        throw new IllegalArgumentException("Out and cmp pdf documents have different object structure");
    }
}
Also used : ObjectPath(com.itextpdf.kernel.utils.objectpathitems.ObjectPath) PdfIndirectReference(com.itextpdf.kernel.pdf.PdfIndirectReference) LocalPathItem(com.itextpdf.kernel.utils.objectpathitems.LocalPathItem) Point(com.itextpdf.kernel.geom.Point) NoninvertibleTransformException(com.itextpdf.kernel.geom.NoninvertibleTransformException) IOException(java.io.IOException) PdfException(com.itextpdf.kernel.exceptions.PdfException)

Aggregations

PdfException (com.itextpdf.kernel.exceptions.PdfException)1 NoninvertibleTransformException (com.itextpdf.kernel.geom.NoninvertibleTransformException)1 Point (com.itextpdf.kernel.geom.Point)1 PdfIndirectReference (com.itextpdf.kernel.pdf.PdfIndirectReference)1 LocalPathItem (com.itextpdf.kernel.utils.objectpathitems.LocalPathItem)1 ObjectPath (com.itextpdf.kernel.utils.objectpathitems.ObjectPath)1 IOException (java.io.IOException)1