RED-7158: add layoutgrid into new ViewerDocument as optional content

* downgraded storage-commons
This commit is contained in:
Kilian Schuettler 2023-08-14 16:03:41 +02:00
parent ea0af08c31
commit 63de8ef82d
2 changed files with 2 additions and 4 deletions

View File

@ -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<COSDictionary> 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");
}

View File

@ -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")