This commit is contained in:
Clarissa.Dietrich 2021-04-21 08:04:56 +02:00
parent 18c1fb482e
commit 8fa03497e9
3 changed files with 23 additions and 3 deletions

View File

@ -96,9 +96,12 @@ public class PdfSegmentationService {
page.setRotation(rotation); page.setRotation(rotation);
page.setLandscape(isLandscape || isRotated); page.setLandscape(isLandscape || isRotated);
page.setPageNumber(pageNumber); page.setPageNumber(pageNumber);
List<PdfImage> imagelist = stripper.getImages(); List<PdfImage> mergedList = processImages(stripper.getImages());
List<PdfImage> mergedList = processImages(imagelist);
page.setImages(mergedList); page.setImages(mergedList);
for (PdfImage image : mergedList) {
image.getImage().flush();
image.getImage().getGraphics().dispose();
}
tableExtractionService.extractTables(cleanRulings, page); tableExtractionService.extractTables(cleanRulings, page);
buildPageStatistics(page); buildPageStatistics(page);
@ -111,6 +114,7 @@ public class PdfSegmentationService {
pages.add(page); pages.add(page);
} }
document.setPages(pages); document.setPages(pages);

View File

@ -484,7 +484,6 @@ public class RedactionIntegrationTest {
@Test @Test
@Ignore
public void noExceptionShouldBeThrownForAnyFiles() throws IOException { public void noExceptionShouldBeThrownForAnyFiles() throws IOException {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();

View File

@ -68,6 +68,23 @@ public class PdfSegmentationServiceTest {
} }
@Test
public void testMergeImages() throws IOException {
ClassPathResource pdfFileResource = new ClassPathResource("files/Minimal Examples/270Rotated.pdf");
Document document = pdfSegmentationService.parseDocument(pdfFileResource.getInputStream());
}
@Test
public void testMergeImages2() throws IOException {
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
Document document = pdfSegmentationService.parseDocument(pdfFileResource.getInputStream());
}
@Test @Test
@Ignore @Ignore
public void testExtractImages() throws IOException { public void testExtractImages() throws IOException {