use of com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool in project i7j-pdfsweep by itext.
the class FilteredImagesCacheTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir, String fuzzValue) throws IOException, InterruptedException {
CleanUpImagesCompareTool cmpTool = new CleanUpImagesCompareTool();
String errorMessage = cmpTool.extractAndCompareImages(output, cmp, targetDir, fuzzValue);
String compareByContentResult = cmpTool.compareByContent(output, cmp, targetDir);
if (compareByContentResult != null) {
errorMessage += compareByContentResult;
}
if (!errorMessage.equals("")) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool in project i7j-pdfsweep by itext.
the class CustomLocationExtractionStrategy method redactIPhoneUserManualMatchColor.
@Test
public void redactIPhoneUserManualMatchColor() throws IOException, InterruptedException {
String input = inputPath + "iphone_user_guide_untagged.pdf";
String output = outputPath + "redactIPhoneUserManualMatchColor.pdf";
String cmp = inputPath + "cmp_redactIPhoneUserManualMatchColor.pdf";
CompositeCleanupStrategy strategy = new CompositeCleanupStrategy();
strategy.add(new CustomLocationExtractionStrategy("(iphone)|(iPhone)"));
PdfDocument pdf = new PdfDocument(new PdfReader(input), new PdfWriter(output));
// sweep
PdfCleaner.autoSweepCleanUp(pdf, strategy);
pdf.close();
// compare
CleanUpImagesCompareTool cmpTool = new CleanUpImagesCompareTool();
String errorMessage = cmpTool.extractAndCompareImages(output, cmp, outputPath, "4");
// TODO DEVSIX-4047 Switch to compareByContent() when the ticket will be resolved
String compareByContentResult = cmpTool.compareVisually(output, cmp, outputPath, "diff_redactIPhoneUserManualMatchColor_", cmpTool.getIgnoredImagesAreas());
if (compareByContentResult != null) {
errorMessage += compareByContentResult;
}
if (!errorMessage.equals("")) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool in project i7j-pdfsweep by itext.
the class BigDocumentCleanUpTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir, String fuzzValue) throws IOException, InterruptedException {
CleanUpImagesCompareTool cmpTool = new CleanUpImagesCompareTool();
String errorMessage = cmpTool.extractAndCompareImages(output, cmp, targetDir, fuzzValue);
String compareByContentResult = cmpTool.compareByContent(output, cmp, targetDir);
if (compareByContentResult != null) {
errorMessage += compareByContentResult;
}
if (!errorMessage.equals("")) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest39.
@Test
public void cleanUpTest39() throws IOException, InterruptedException {
String input = INPUT_PATH + "corruptJpeg.pdf";
String output = OUTPUT_PATH + "corruptJpeg.pdf";
String cmp = INPUT_PATH + "cmp_corruptJpeg.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(100, 350, 100, 200), ColorConstants.ORANGE));
cleanUp(input, output, cleanUpLocations);
CleanUpImagesCompareTool cmpTool = new CleanUpImagesCompareTool();
String errorMessage = cmpTool.extractAndCompareImages(output, cmp, OUTPUT_PATH, "1.2");
String compareByContentResult = cmpTool.compareByContent(output, cmp, OUTPUT_PATH);
if (compareByContentResult != null) {
errorMessage += compareByContentResult;
}
if (!errorMessage.equals("")) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.pdfcleanup.util.CleanUpImagesCompareTool in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest05.
@Test
public void cleanUpTest05() throws IOException, InterruptedException {
String input = INPUT_PATH + "BigImage-jpg.pdf";
String output = OUTPUT_PATH + "BigImage-jpg.pdf";
String cmp = INPUT_PATH + "cmp_BigImage-jpg.pdf";
cleanUp(input, output, null);
CleanUpImagesCompareTool cmpTool = new CleanUpImagesCompareTool();
String errorMessage = cmpTool.extractAndCompareImages(output, cmp, OUTPUT_PATH, "1");
String compareByContentResult = cmpTool.compareByContent(output, cmp, OUTPUT_PATH);
if (compareByContentResult != null) {
errorMessage += compareByContentResult;
}
if (!errorMessage.equals("")) {
Assert.fail(errorMessage);
}
}
Aggregations