Merge branch 'CLARI-139' into 'main'
CLAR-139 - fixed outline error for unparsable object See merge request fforesight/layout-parser!188
This commit is contained in:
+10
-2
@@ -82,10 +82,18 @@ public class OutlineExtractorService {
|
||||
|
||||
String title = item.getTitle();
|
||||
|
||||
PDPage page = item.findDestinationPage(document);
|
||||
if (page == null) {
|
||||
PDPage page;
|
||||
try {
|
||||
// Can throw: "Error: can't convert to Destination COSArray" for some OCR'd PDFs
|
||||
page = item.findDestinationPage(document);
|
||||
if (page == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}catch (IOException e){
|
||||
log.info(String.format("Error occurred during position resolution for outline item with title %s: " + e, title));
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
int pageNumber = document.getPages().indexOf(page);
|
||||
|
||||
Optional<Point2D> outlinePosition = Optional.empty();
|
||||
|
||||
+10
@@ -1,5 +1,6 @@
|
||||
package com.knecon.fforesight.service.layoutparser.server;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -56,6 +57,15 @@ public class OutlineDetectionTest extends AbstractTest {
|
||||
pdfNetInitializer.init();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testOutlineError(){
|
||||
String fileName = "files/syngenta/CustomerFiles/Clarifynd/VV-470942.pdf";
|
||||
|
||||
ClassificationDocument classificationDocument = parseLayout(fileName, LayoutParsingType.CLARIFYND);
|
||||
assertThat(classificationDocument).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
|
||||
Reference in New Issue
Block a user