Verified Owner
Top Fields Constructors Methods
org.jabref.logic.ocr

public final Class OcrUtils

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.Path, java.util.ArrayList, java.util.concurrent.TimeUnit, org.jabref.logic.util.HeadlessExecutorService, .StreamGobbler, org.jabref.logic.util.io.FileUtil, org.jabref.logic.util.strings.StringUtil, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
public static final int
public static final Logger
public static final String
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if the engine is available, false otherwise.
isAvailable
(OcrPreferences ocrPreferences)

Checks if the OCR engine is available for use.

public static Path

Returns:

the output path of the searchable OCRed PDF.
makeOutputFilePath
(Path
the path of the PDF that needs to be OCRed.
inputPath
)

Generates the output path for the searchable PDF.

public static OcrResult
performOcr(ArrayList<String> command, String engineName)

Helper method to abstract the common logic of running an OCR engine command and handling its output.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHECKING_TIMEOUTback to summary
public static final int CHECKING_TIMEOUT
LOGGERback to summary
public static final Logger LOGGER
OCR_PDF_PREFIXback to summary
public static final String OCR_PDF_PREFIX
TIMEOUT_MINSback to summary
public static final int TIMEOUT_MINS

Constructor Detail

OcrUtilsback to summary
public OcrUtils()

Method Detail

isAvailableback to summary
public static boolean isAvailable(OcrPreferences ocrPreferences)

Checks if the OCR engine is available for use.

Returns:boolean

true if the engine is available, false otherwise.

makeOutputFilePathback to summary
public static Path makeOutputFilePath(Path inputPath)

Generates the output path for the searchable PDF.

Example: Documents/my files/document.pdf -> Documents/my files/document_ocr.pdf.

Parameters
inputPath:Path

the path of the PDF that needs to be OCRed.

Returns:Path

the output path of the searchable OCRed PDF.

performOcrback to summary
public static OcrResult performOcr(ArrayList<String> command, String engineName)

Helper method to abstract the common logic of running an OCR engine command and handling its output.