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");
}
}
Aggregations