use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpImageUtilTest method cleanUpImageNullImageBytesTest.
@Test
public void cleanUpImageNullImageBytesTest() {
List<Rectangle> areasToBeCleaned = new ArrayList<>();
areasToBeCleaned.add(new Rectangle(100, 100));
junitExpectedException.expect(RuntimeException.class);
CleanUpImageUtil.cleanUpImage(null, areasToBeCleaned);
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpImageUtilTest method cleanUpImageEmptyAreasToCleanTest.
@Test
public void cleanUpImageEmptyAreasToCleanTest() throws Exception {
ImageData data = ImageDataFactory.create(SOURCE_PATH + "cleanUpImageEmptyAreasToClean.png");
PdfImageXObject imageXObject = new PdfImageXObject(data);
byte[] sourceImageBytes = imageXObject.getImageBytes();
byte[] resultImageBytes = CleanUpImageUtil.cleanUpImage(new PdfImageXObject(data).getImageBytes(), new ArrayList<Rectangle>());
Assert.assertArrayEquals(sourceImageBytes, resultImageBytes);
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest12.
@Test
public void cleanUpTest12() throws IOException, InterruptedException {
String input = INPUT_PATH + "multiUseImage.pdf";
String output = OUTPUT_PATH + "multiUseImage.pdf";
String cmp = INPUT_PATH + "cmp_multiUseImage.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(97f, 405f, 480f - 97f, 445f - 405f), ColorConstants.GRAY));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_12");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest43.
@Test
public void cleanUpTest43() throws IOException, InterruptedException {
String input = INPUT_PATH + "newLines03.pdf";
String output = OUTPUT_PATH + "newLines03.pdf";
String cmp = INPUT_PATH + "cmp_newLines03.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(36f, 733f, 230f, 5f), ColorConstants.ORANGE));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_43");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest35.
@Test
public void cleanUpTest35() throws IOException, InterruptedException {
String input = INPUT_PATH + "lineArtsSimple.pdf";
String output = OUTPUT_PATH + "lineArtsSimple.pdf";
String cmp = INPUT_PATH + "cmp_lineArtsSimple.pdf";
cleanUp(input, output, Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(60f, 80f, 460f, 65f), ColorConstants.GRAY)));
compareByContent(cmp, output, OUTPUT_PATH, "diff_35");
}
Aggregations