Compare commits

...
4 Commits
Author SHA1 Message Date
Philipp Schramm e535861da8 Pull request #2: RED-5911 Bugfix for removed texts within tables
Merge in RED/ocr-service from RED-5911 to master

* commit '0e8dfed4410b28a6316f8e328fc166339852565f':
  RED-5911 Bugfix for removed texts within tables
2023-01-04 15:02:15 +01:00
Philipp Schramm 0e8dfed441 RED-5911 Bugfix for removed texts within tables 2023-01-04 12:31:51 +01:00
Dominique Eiflaender 2fe0eb024a Pull request #1: RSS-146: Install Ghostscript to imporve ocr quality
Merge in RED/ocr-service from RSS-146 to master

* commit '37548ddbf89c0ca5e25d18b19af9400ef5e608c0':
  RSS-146: Install Ghostscript to imporve ocr quality
2022-12-14 17:41:01 +01:00
deiflaender 37548ddbf8 RSS-146: Install Ghostscript to imporve ocr quality 2022-12-14 16:11:00 +01:00
3 changed files with 8 additions and 2 deletions
@@ -5,6 +5,10 @@ RUN tar xvzf OCRModuleLinux.tar.gz
RUN mkdir /OCRModule
RUN mv Lib/* /OCRModule/
RUN apt-get -y update
# Ghostscript somehow improves ocr quality using pdfton, do not remove!
RUN apt-get -y install ghostscript
ARG PLATFORM_JAR
ENV PLATFORM_JAR ${PLATFORM_JAR}
@@ -285,7 +285,7 @@ public class OCRService {
var gState = element.getGState();
//See PDF Reference 5.3 Text rendering modes, 3 = Invisible, however this ocr does not use it.
if (!filledRectangleIntersection && gState.getTextRenderMode() != 3) {
if (!filledRectangleIntersection && gState.getTextRenderMode() != 3 || filledRectangleIntersection && gState.getTextRenderMode() == 0) {
writer.writeElement(element);
}
}
@@ -294,10 +294,10 @@ public class OCRService {
@SneakyThrows
private void processPath(Element element, ElementWriter writer, Set<Rect> filledRectangles) {
writer.writeElement(element);
if (element.getPathData() != null && element.getPathData().getPoints().length > 4) {
filledRectangles.add(element.getBBox());
}
writer.writeElement(element);
}
@@ -76,6 +76,8 @@ public class OcrServiceIntegrationTest {
var out = FileUtils.openOutputStream(new File(getTemporaryDirectory() + "/" + fileName + ".pdf"));
IOUtils.copy(response, out);
System.out.println("File:" + getTemporaryDirectory() + "/" + fileName + ".pdf");
}