Scanning and OCR (IRPCScanningAndOCR)
Runs server-side OCR: converts files to searchable PDF and recognizes text in page areas.
| gRPC service | MFiles.IRPCScanningAndOCR |
|---|---|
| Book and level | Vault API, standard |
| Methods | 8 |
| Proto file | mfiles/IRPCScanningAndOCR.proto |
Overview
OCR runs on the server as a background operation of the calling session. A job is started, polled and ended:
- Check that server OCR is available with
GetScanningAndOCROptions
(
allow_server_ocr,allowed_file_extensions). - Start the job:
- on a file you upload: OCROperation_BeginAfterUpload, or
- on a file of a checked-out document in the vault: OCROperation_Begin.
- Poll OCROperation_Status until
done. - End the job, which also releases it:
- OCROperation_EndWithDownload returns the recognized texts and a download of the resulting PDF, or
- OCROperation_End replaces the document's file in the vault with the resulting PDF.
The background_op_id exists only in the memory of the server that started the job: poll and
end the job on the same server. After the job has ended, or after
it failed and the failure was reported, the ID is no longer valid and calls fail with "The
parameter is incorrect.".
Operation types (OCROperationType):
..._CONVERT_TO_SEARCHABLE_PDF and ..._CONVERT_TO_SEARCHABLE_ARCHIVE_PDF (PDF/A-1b) produce a
PDF; ..._RECOGNIZE_SPECIFIC_BLOCKS reads the text of the areas given in pages; ..._RECOGNIZE_ANY_BLOCKS returns the text areas it
finds; the combined types do both.
All methods need a vault session. Files are covered in Files.
Methods
| Method | Summary | Facts |
|---|---|---|
| GetOCRUploadedFileStatus | Gets the state of an OCR job started with OCRUploadedFile and, when it has completed, its result as a file_ref. Optionally requests the cancellation of the job. | write session |
| GetScanningAndOCROptions | Gets whether scanning and client- and server-side OCR are enabled for the vault, and for which file types. | read session idempotent returns metadata structure version |
| OCROperation_Begin | Starts an OCR job on a file of a document that the caller has checked out. | write session idempotent returns metadata structure version |
| OCROperation_BeginAfterUpload | Starts an OCR job on a file that the caller uploaded with UploadTempFile. | write session idempotent returns metadata structure version |
| OCROperation_End | Ends an OCR job started with OCROperation_Begin and replaces the document's file with the resulting PDF. | write session returns metadata structure version |
| OCROperation_EndWithDownload | Ends an OCR job and returns its results: the recognized texts and a download of the PDF. | write session returns metadata structure version |
| OCROperation_Status | Gets the progress of an OCR job, and optionally cancels it. | write session idempotent returns metadata structure version |
| OCRUploadedFile | Starts an OCR job that converts the file of a stateless upload to a searchable PDF. | write session |