use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class CleanUpImageIndexedColorSpaceTest method noWhiteColorTest.
@Test
public void noWhiteColorTest() throws Exception {
String input = inputPath + "indexedImageNoWhite.pdf";
String output = outputPath + "indexedImageNoWhite.pdf";
String cmp = inputPath + "cmp_indexedImageNoWhite.pdf";
try (PdfDocument pdfDocument = new PdfDocument(new PdfReader(input), new PdfWriter(output))) {
PdfCleaner.cleanUp(pdfDocument, Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(150, 250, 100, 100))));
}
/*
Result in Java and .NET is different.
Java is able to process images with indexed colorspace same as others and
doesn't preserve indexed colorspace. .NET requires special processing for
indexed colorspace images, but preserves indexed colorspace.
In .NET color of cleaned area is the first color of indexed color palette.
In Java color of cleaned area is white.
*/
Assert.assertNull(new CompareTool().compareByContent(output, cmp, outputPath));
}
use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class CleanUpTextTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir) throws IOException, InterruptedException {
CompareTool cmpTool = new CompareTool();
String errorMessage = cmpTool.compareByContent(output, cmp, targetDir);
if (errorMessage != null) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class CleanUpAnnotationTest method compareByContent.
private void compareByContent(String cmp, String output, String targetDir, String diffPrefix) throws IOException, InterruptedException {
CompareTool cmpTool = new CompareTool();
String errorMessage = cmpTool.compareByContent(output, cmp, targetDir, diffPrefix + "_");
if (errorMessage != null) {
Assert.fail(errorMessage);
}
}
use of com.itextpdf.kernel.utils.CompareTool in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTestFontColor.
@Test
public void cleanUpTestFontColor() throws IOException, InterruptedException {
String filename = "fontCleanup.pdf";
PdfDocument pdfDoc = new PdfDocument(new PdfReader(INPUT_PATH + filename), new PdfWriter(OUTPUT_PATH + filename));
PdfCleaner.cleanUpRedactAnnotations(pdfDoc);
pdfDoc.close();
Assert.assertNull(new CompareTool().compareVisually(OUTPUT_PATH + filename, INPUT_PATH + "cmp_" + filename, OUTPUT_PATH, "diff_"));
}
Aggregations