Search in sources :

Example 96 with Rectangle

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);
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) ArrayList(java.util.ArrayList) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test)

Example 97 with Rectangle

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);
}
Also used : PdfImageXObject(com.itextpdf.kernel.pdf.xobject.PdfImageXObject) ImageData(com.itextpdf.io.image.ImageData) Rectangle(com.itextpdf.kernel.geom.Rectangle) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test)

Example 98 with Rectangle

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");
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfString(com.itextpdf.kernel.pdf.PdfString) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test)

Example 99 with Rectangle

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");
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfString(com.itextpdf.kernel.pdf.PdfString) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test)

Example 100 with Rectangle

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");
}
Also used : Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfString(com.itextpdf.kernel.pdf.PdfString) IntegrationTest(com.itextpdf.test.annotations.type.IntegrationTest) ExtendedITextTest(com.itextpdf.test.ExtendedITextTest) Test(org.junit.Test)

Aggregations

Rectangle (com.itextpdf.kernel.geom.Rectangle)118 ExtendedITextTest (com.itextpdf.test.ExtendedITextTest)76 IntegrationTest (com.itextpdf.test.annotations.type.IntegrationTest)76 Test (org.junit.Test)76 PdfString (com.itextpdf.kernel.pdf.PdfString)42 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)41 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)37 ArrayList (java.util.ArrayList)29 PdfReader (com.itextpdf.kernel.pdf.PdfReader)22 PdfCanvas (com.itextpdf.kernel.pdf.canvas.PdfCanvas)16 Paragraph (com.itextpdf.layout.element.Paragraph)15 PdfFont (com.itextpdf.kernel.font.PdfFont)12 Document (com.itextpdf.layout.Document)12 Canvas (com.itextpdf.layout.Canvas)11 PdfPage (com.itextpdf.kernel.pdf.PdfPage)10 ColumnDocumentRenderer (com.itextpdf.layout.ColumnDocumentRenderer)9 LogMessages (com.itextpdf.test.annotations.LogMessages)9 AreaBreak (com.itextpdf.layout.element.AreaBreak)8 PdfCleanUpLocation (com.itextpdf.pdfcleanup.PdfCleanUpLocation)8 HyphenationConfig (com.itextpdf.layout.hyphenation.HyphenationConfig)7