pdfOCR 4.1.2 API
iText.Pdfocr.Onnxtr.OnnxTrOcrEngine Class Reference

iText.Pdfocr.IOcrEngine implementation, based on OnnxTR/DocTR machine learning OCR projects. More...

Inheritance diagram for iText.Pdfocr.Onnxtr.OnnxTrOcrEngine:
iText.Pdfocr.IOcrEngine iText.Pdfocr.IProductAware

Public Member Functions

  OnnxTrOcrEngine (IDetectionPredictor detectionPredictor, IOrientationPredictor orientationPredictor, IRecognitionPredictor recognitionPredictor)
  Create a new OCR engine with the provided predictors. More...
 
  OnnxTrOcrEngine (IDetectionPredictor detectionPredictor, IOrientationPredictor orientationPredictor, IRecognitionPredictor recognitionPredictor, OnnxTrEngineProperties properties)
  Create a new OCR engine with the provided predictors. More...
 
  OnnxTrOcrEngine (IDetectionPredictor detectionPredictor, IRecognitionPredictor recognitionPredictor)
  Create a new OCR engine with the provided predictors, without text orientation prediction. More...
 
virtual void  Close ()
 
virtual IDictionary< int, IList< TextInfo > >  DoImageOcr (FileInfo input)
  Reads data from the provided input image file and returns retrieved data in the format described below. More...
 
virtual IDictionary< int, IList< TextInfo > >  DoImageOcr (FileInfo input, OcrProcessContext ocrProcessContext)
  Reads data from the provided input image file and returns retrieved data in the format described below. More...
 
virtual void  CreateTxtFile (IList< FileInfo > inputImages, FileInfo txtFile)
  Performs OCR using provided IOcrEngine for the given list of input images and saves output to a text file using provided path. More...
 
virtual void  CreateTxtFile (IList< FileInfo > inputImages, FileInfo txtFile, OcrProcessContext ocrProcessContext)
  Performs OCR using provided IOcrEngine for the given list of input images and saves output to a text file using provided path. More...
 
virtual bool  IsTaggingSupported ()
  Checks whether tagging is supported by the OCR engine. More...
 
virtual PdfOcrMetaInfoContainer  GetMetaInfoContainer ()
  Gets the container with meta info. More...
 
virtual ProductData  GetProductData ()
  Gets object containing information about the product. More...
 

Detailed Description

iText.Pdfocr.IOcrEngine implementation, based on OnnxTR/DocTR machine learning OCR projects.

iText.Pdfocr.IOcrEngine implementation, based on OnnxTR/DocTR machine learning OCR projects.

NOTE: OnnxTrOcrEngine instance shall be closed after all usages to avoid native allocations leak.

Constructor & Destructor Documentation

◆ OnnxTrOcrEngine() [1/3]

iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.OnnxTrOcrEngine ( IDetectionPredictor  detectionPredictor,
IOrientationPredictor  orientationPredictor,
IRecognitionPredictor  recognitionPredictor 
)
inline

Create a new OCR engine with the provided predictors.

Parameters
detectionPredictor text detector. For an input image it outputs a list of text boxes
orientationPredictor text orientation predictor. For an input image, which is a tight crop of text, it outputs its orientation in 90 degrees steps. Can be null, in that case all text is assumed to be upright
recognitionPredictor text recognizer. For an input image, which is a tight crop of text, it outputs the displayed string

◆ OnnxTrOcrEngine() [2/3]

iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.OnnxTrOcrEngine ( IDetectionPredictor  detectionPredictor,
IOrientationPredictor  orientationPredictor,
IRecognitionPredictor  recognitionPredictor,
OnnxTrEngineProperties  properties 
)
inline

Create a new OCR engine with the provided predictors.

Parameters
detectionPredictor text detector. For an input image it outputs a list of text boxes
orientationPredictor text orientation predictor. For an input image, which is a tight crop of text, it outputs its orientation in 90 degrees steps. Can be null, in that case all text is assumed to be upright
recognitionPredictor text recognizer. For an input image, which is a tight crop of text, it outputs the displayed string
properties set of properties

◆ OnnxTrOcrEngine() [3/3]

iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.OnnxTrOcrEngine ( IDetectionPredictor  detectionPredictor,
IRecognitionPredictor  recognitionPredictor 
)
inline

Create a new OCR engine with the provided predictors, without text orientation prediction.

Parameters
detectionPredictor text detector. For an input image it outputs a list of text boxes
recognitionPredictor text recognizer. For an input image, which is a tight crop of text, it outputs the displayed string

Member Function Documentation

◆ Close()

virtual void iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.Close ( )
inlinevirtual

◆ CreateTxtFile() [1/2]

virtual void iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.CreateTxtFile ( IList< FileInfo >  inputImages,
FileInfo  txtFile 
)
inlinevirtual

Performs OCR using provided IOcrEngine for the given list of input images and saves output to a text file using provided path.

Implements iText.Pdfocr.IOcrEngine.

◆ CreateTxtFile() [2/2]

virtual void iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.CreateTxtFile ( IList< FileInfo >  inputImages,
FileInfo  txtFile,
OcrProcessContext  ocrProcessContext 
)
inlinevirtual

Performs OCR using provided IOcrEngine for the given list of input images and saves output to a text file using provided path.

Implements iText.Pdfocr.IOcrEngine.

◆ DoImageOcr() [1/2]

virtual IDictionaryTextInfo> > iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.DoImageOcr ( FileInfo  input )
inlinevirtual

Reads data from the provided input image file and returns retrieved data in the format described below.

Implements iText.Pdfocr.IOcrEngine.

◆ DoImageOcr() [2/2]

virtual IDictionaryTextInfo> > iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.DoImageOcr ( FileInfo  input,
OcrProcessContext  ocrProcessContext 
)
inlinevirtual

Reads data from the provided input image file and returns retrieved data in the format described below.

Implements iText.Pdfocr.IOcrEngine.

◆ GetMetaInfoContainer()

virtual PdfOcrMetaInfoContainer iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.GetMetaInfoContainer ( )
inlinevirtual

Gets the container with meta info.

Implements iText.Pdfocr.IProductAware.

◆ GetProductData()

virtual ProductData iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.GetProductData ( )
inlinevirtual

Gets object containing information about the product.

Implements iText.Pdfocr.IProductAware.

◆ IsTaggingSupported()

virtual bool iText.Pdfocr.Onnxtr.OnnxTrOcrEngine.IsTaggingSupported ( )
inlinevirtual

Checks whether tagging is supported by the OCR engine.

Implements iText.Pdfocr.IOcrEngine.