From 63de8ef82d683750a4f26b14d1877a32927946f1 Mon Sep 17 00:00:00 2001 From: Kilian Schuettler Date: Mon, 14 Aug 2023 16:03:41 +0200 Subject: [PATCH] RED-7158: add layoutgrid into new ViewerDocument as optional content * downgraded storage-commons --- .../services/visualization/ViewerDocumentService.java | 4 +--- .../layoutparser-service-server/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/layoutparser-service/layoutparser-service-processor/src/main/java/com/knecon/fforesight/service/layoutparser/processor/services/visualization/ViewerDocumentService.java b/layoutparser-service/layoutparser-service-processor/src/main/java/com/knecon/fforesight/service/layoutparser/processor/services/visualization/ViewerDocumentService.java index 7690b19..ade1342 100644 --- a/layoutparser-service/layoutparser-service-processor/src/main/java/com/knecon/fforesight/service/layoutparser/processor/services/visualization/ViewerDocumentService.java +++ b/layoutparser-service/layoutparser-service-processor/src/main/java/com/knecon/fforesight/service/layoutparser/processor/services/visualization/ViewerDocumentService.java @@ -52,9 +52,8 @@ public class ViewerDocumentService { log.info("Start Viewer Document Creation"); LayoutGrid layoutGrid = layoutGridService.createLayoutGrid(document); - log.info("Created Layout Grid"); // PDDocument.save() is very slow, since it actually traverses the entire pdf and writes a new one. - // If we collect all COSDictionaries we changed and tell it explicitly to only add the changed ones it's very fast. + // If we collect all COSDictionaries we changed and tell it explicitly to only add the changed ones by using saveIncremental it's very fast. Set dictionariesToUpdate = new HashSet<>(); PDOptionalContentGroup layer = addLayerToDocument(pdDocument, dictionariesToUpdate); PDFont font = PDType1Font.HELVETICA; @@ -119,7 +118,6 @@ public class ViewerDocumentService { dictionariesToUpdate.add(pdPage.getCOSObject()); dictionariesToUpdate.add(pdPage.getResources().getCOSObject()); } - log.info("Written Layoutgrid to pdf streams"); pdDocument.saveIncremental(outputStream, dictionariesToUpdate); log.info("Saved Viewer Document"); } diff --git a/layoutparser-service/layoutparser-service-server/build.gradle.kts b/layoutparser-service/layoutparser-service-server/build.gradle.kts index d2ab67a..467b14e 100644 --- a/layoutparser-service/layoutparser-service-server/build.gradle.kts +++ b/layoutparser-service/layoutparser-service-server/build.gradle.kts @@ -19,7 +19,7 @@ dependencies { implementation(project(":layoutparser-service-processor")) implementation(project(":layoutparser-service-internal-api")) - implementation("com.iqser.red.commons:storage-commons:2.31.0") + implementation("com.iqser.red.commons:storage-commons:2.27.0") implementation("com.knecon.fforesight:tenant-commons:0.10.0") implementation("org.springframework.boot:spring-boot-starter-actuator:3.1.2") implementation("com.amazonaws:aws-java-sdk-s3:1.12.528")