Scanning and OCR (IRPCScanningAndOCR)

View as Markdown

Runs server-side OCR: converts files to searchable PDF and recognizes text in page areas.

gRPC serviceMFiles.IRPCScanningAndOCR
Book and levelVault API, standard
Methods8
Proto filemfiles/IRPCScanningAndOCR.proto

Overview

OCR runs on the server as a background operation of the calling session. A job is started, polled and ended:

  1. Check that server OCR is available with GetScanningAndOCROptions (allow_server_ocr, allowed_file_extensions).
  2. Start the job:
  3. Poll OCROperation_Status until done.
  4. End the job, which also releases it:

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

MethodSummaryFacts
GetOCRUploadedFileStatusGets 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
GetScanningAndOCROptionsGets 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_BeginStarts an OCR job on a file of a document that the caller has checked out.write session idempotent returns metadata structure version
OCROperation_BeginAfterUploadStarts an OCR job on a file that the caller uploaded with UploadTempFile.write session idempotent returns metadata structure version
OCROperation_EndEnds an OCR job started with OCROperation_Begin and replaces the document's file with the resulting PDF.write session returns metadata structure version
OCROperation_EndWithDownloadEnds an OCR job and returns its results: the recognized texts and a download of the PDF.write session returns metadata structure version
OCROperation_StatusGets the progress of an OCR job, and optionally cancels it.write session idempotent returns metadata structure version
OCRUploadedFileStarts an OCR job that converts the file of a stateless upload to a searchable PDF.write session