use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class PdfCleanUpToolTest method cleanUpTest46.
@Test
public void cleanUpTest46() throws IOException {
String input = INPUT_PATH + "emptyPdf.pdf";
String output = OUTPUT_PATH + "emptyPdf.pdf";
PdfAnnotation redactAnnotation = new PdfRedactAnnotation(new Rectangle(97, 405, 383, 40)).setOverlayText(new PdfString("OverlayTest"));
try (PdfReader reader = new PdfReader(input);
PdfWriter writer = new PdfWriter(output);
PdfDocument pdfDocument = new PdfDocument(reader, writer)) {
pdfDocument.getFirstPage().addAnnotation(redactAnnotation);
Exception e = Assert.assertThrows(PdfException.class, () -> PdfCleaner.cleanUpRedactAnnotations(pdfDocument));
Assert.assertEquals(CleanupExceptionMessageConstant.DEFAULT_APPEARANCE_NOT_FOUND, e.getMessage());
}
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpAnnotationTest method cleanTextAnnotation01.
@Test
public void cleanTextAnnotation01() throws IOException, InterruptedException {
String input = inputPath + "cleanAnnotation.pdf";
String output = outputPath + "cleanAnnotation_Text01.pdf";
String cmp = inputPath + "cmp_cleanAnnotation_Text01.pdf";
List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();
PdfCleanUpLocation textLoc = new PdfCleanUpLocation(1, new Rectangle(150, 650, 0, 0), ColorConstants.RED);
cleanUpLocations.add(textLoc);
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, outputPath, "diff_Annotation_text01");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpAnnotationTest method cleanLineAnnotation01.
@Test
public void cleanLineAnnotation01() throws IOException, InterruptedException {
String input = inputPath + "cleanAnnotation.pdf";
String output = outputPath + "cleanAnnotation_Line01.pdf";
String cmp = inputPath + "cmp_cleanAnnotation_Line01.pdf";
List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();
PdfCleanUpLocation lineLoc = new PdfCleanUpLocation(1, new Rectangle(20, 20, 555, 0), ColorConstants.GREEN);
cleanUpLocations.add(lineLoc);
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, outputPath, "diff_Annotation_line01");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpAnnotationTest method cleanFormAnnotations01.
@Test
public void cleanFormAnnotations01() throws IOException, InterruptedException {
String input = inputPath + "formAnnotation.pdf";
String output = outputPath + "formAnnotation01.pdf";
String cmp = inputPath + "cmp_formAnnotation01.pdf";
List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();
PdfCleanUpLocation highLightLoc = new PdfCleanUpLocation(1, new Rectangle(20, 600, 500, 170), ColorConstants.YELLOW);
cleanUpLocations.add(highLightLoc);
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, outputPath, "diff_form01");
}
use of com.itextpdf.kernel.geom.Rectangle in project i7j-pdfsweep by itext.
the class CleanUpAnnotationTest method cleanFormAnnotations02.
@Test
public void cleanFormAnnotations02() throws IOException, InterruptedException {
String input = inputPath + "formAnnotation.pdf";
String output = outputPath + "formAnnotation02.pdf";
String cmp = inputPath + "cmp_formAnnotation02.pdf";
List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();
PdfCleanUpLocation highLightLoc = new PdfCleanUpLocation(1, new Rectangle(20, 600, 300, 100), ColorConstants.YELLOW);
cleanUpLocations.add(highLightLoc);
cleanUp(input, output, cleanUpLocations);
compareByContent(cmp, output, outputPath, "diff_form02");
}
Aggregations