use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest37.
/**
* In this test we check that line style operators (such as 'w') are processed correctly
*/
@Test
public void cleanUpTest37() throws IOException, InterruptedException {
String input = INPUT_PATH + "helloHelvetica.pdf";
String output = OUTPUT_PATH + "helloHelvetica.pdf";
String cmp = INPUT_PATH + "cmp_helloHelvetica.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(0f, 0f, 595f, 680f), ColorConstants.GRAY));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_37");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method autoCleanWithCleaUpPropertiesTest.
@Test
public void autoCleanWithCleaUpPropertiesTest() throws Exception {
String input = INPUT_PATH + "absentICentry.pdf";
String output = OUTPUT_PATH + "autoCleanWithCleaUpPropertiesTest.pdf";
String cmp = INPUT_PATH + "cmp_autoCleanWithCleaUpPropertiesTest.pdf";
CompositeCleanupStrategy strategy = new CompositeCleanupStrategy();
strategy.add(new RegexBasedCleanupStrategy("leonard"));
List<PdfCleanUpLocation> additionalLocation = new ArrayList<>();
additionalLocation.add(new PdfCleanUpLocation(1, new Rectangle(100, 100, 500, 500)));
PdfCleaner.autoSweepCleanUp(new FileInputStream(input), new FileOutputStream(output), strategy, additionalLocation, new CleanUpProperties());
compareByContent(cmp, output, OUTPUT_PATH, "autoCleanWithCleaUpPropertiesTest");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method autoCleanPageWithAdditionalLocationAndPropertyTest.
@Test
public void autoCleanPageWithAdditionalLocationAndPropertyTest() throws Exception {
String input = INPUT_PATH + "fontCleanup.pdf";
String output = OUTPUT_PATH + "autoCleanPageWithAdditionalLocationAndPropertyTest.pdf";
String cmp = INPUT_PATH + "cmp_autoCleanPageWithAdditionalLocationAndPropertyTest.pdf";
CompositeCleanupStrategy strategy = new CompositeCleanupStrategy();
strategy.add(new RegexBasedCleanupStrategy("leonard"));
List<PdfCleanUpLocation> additionalLocation = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(0, 0, 200, 100), ColorConstants.RED));
try (PdfReader reader = new PdfReader(input);
PdfWriter writer = new PdfWriter(output);
PdfDocument document = new PdfDocument(reader, writer)) {
PdfCleaner.autoSweepCleanUp(document.getPage(1), strategy, additionalLocation, new CleanUpProperties());
}
compareByContent(cmp, output, OUTPUT_PATH, "autoCleanPageWithAdditionalLocationAndPropertyTest");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest42.
@Test
public void cleanUpTest42() throws IOException, InterruptedException {
String input = INPUT_PATH + "newLines02.pdf";
String output = OUTPUT_PATH + "newLines02.pdf";
String cmp = INPUT_PATH + "cmp_newLines02.pdf";
List<PdfCleanUpLocation> cleanUpLocations = Arrays.asList(new PdfCleanUpLocation(1, new Rectangle(36f, 733f, 270f, 5f), ColorConstants.ORANGE));
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, OUTPUT_PATH, "diff_42");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method pathAndIncorrectCMTest.
@Test
@LogMessages(messages = @LogMessage(messageTemplate = CleanUpLogMessageConstant.FAILED_TO_PROCESS_A_TRANSFORMATION_MATRIX, count = 7))
public void pathAndIncorrectCMTest() throws IOException, InterruptedException {
String fileName = "pathAndIncorrectCM";
String input = INPUT_PATH + "pathAndIncorrectCM.pdf";
String output = OUTPUT_PATH + fileName + ".pdf";
String cmp = INPUT_PATH + "cmp_" + fileName + ".pdf";
List<PdfCleanUpLocation> dummyLocationsList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
dummyLocationsList.add(new PdfCleanUpLocation(i + 1, new Rectangle(0, 0, 0, 0), null));
}
cleanUp(input, output, dummyLocationsList);
compareByContent(cmp, output, OUTPUT_PATH, "diff_pathAndIncorrectCMTest");
}
Aggregations