use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest44.
@Test
public void cleanUpTest44() throws IOException, InterruptedException {
String input = INPUT_PATH + "emptyTj02.pdf";
String output = OUTPUT_PATH + "emptyTj02.pdf";
String cmp = INPUT_PATH + "cmp_emptyTj02.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(70f, 565f, 200f, 5f), ColorConstants.ORANGE));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_44");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest34.
@Test
public void cleanUpTest34() throws IOException, InterruptedException {
String input = INPUT_PATH + "new_york_times.pdf";
String output = OUTPUT_PATH + "textAndImages.pdf";
String cmp = INPUT_PATH + "cmp_textAndImages.pdf";
cleanUp(input, output, Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(150f, 235f, 230f, 445f))));
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.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest01.
@Test
public void cleanUpTest01() throws IOException, InterruptedException {
String input = INPUT_PATH + "page229.pdf";
String output = OUTPUT_PATH + "page229_01.pdf";
String cmp = INPUT_PATH + "cmp_page229_01.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(240.0f, 602.3f, 275.7f - 240.0f, 614.8f - 602.3f), ColorConstants.GRAY), new PdfCleanUpLocation(1, new Rectangle(171.3f, 550.3f, 208.4f - 171.3f, 562.8f - 550.3f), ColorConstants.GRAY), new PdfCleanUpLocation(1, new Rectangle(270.7f, 459.2f, 313.1f - 270.7f, 471.7f - 459.2f), ColorConstants.GRAY), new PdfCleanUpLocation(1, new Rectangle(249.9f, 329.3f, 279.6f - 249.9f, 341.8f - 329.3f), ColorConstants.GRAY), new PdfCleanUpLocation(1, new Rectangle(216.2f, 303.3f, 273.0f - 216.2f, 315.8f - 303.3f), ColorConstants.GRAY));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_01");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method simpleCleanUpOnRotatedPagesIgnoreRotation.
@Test
public void simpleCleanUpOnRotatedPagesIgnoreRotation() throws IOException, InterruptedException {
String fileName = "simpleCleanUpOnRotatedPagesIgnoreRotation";
String input = INPUT_PATH + "documentWithRotatedPages.pdf";
String output = OUTPUT_PATH + fileName + ".pdf";
String cmp = INPUT_PATH + "cmp_" + fileName + ".pdf";
PdfDocument pdfDocument = new PdfDocument(new PdfReader(input), new PdfWriter(output));
List<PdfCleanUpLocation> locationsList = new ArrayList<>();
for (int i = 0; i < 4; i++) {
locationsList.add(new PdfCleanUpLocation(i + 1, Rectangle.getRectangleOnRotatedPage(new Rectangle(100, 100, 200, 100), pdfDocument.getPage(i + 1)), ColorConstants.GREEN));
}
PdfCleaner.cleanUp(pdfDocument, locationsList);
pdfDocument.close();
compareByContent(cmp, output, OUTPUT_PATH, "diff_pathAndIncorrectCMTest");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest41.
@Test
public void cleanUpTest41() throws IOException, InterruptedException {
String input = INPUT_PATH + "newLines01.pdf";
String output = OUTPUT_PATH + "newLines01.pdf";
String cmp = INPUT_PATH + "cmp_newLines01.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(70f, 555f, 200f, 10f), ColorConstants.ORANGE));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_41");
}
Aggregations