@@ -4595,6 +4595,68 @@ def riviera_get_metadata_async_check(self, async_job_id):
45954595 )
45964596 return r
45974597
4598+ def riviera_get_ocr_async (self , file_id_or_url = None ):
4599+ """
4600+ Asynchronous OCR (optical character recognition) text extraction for
4601+ images and PDFs, including scanned / non-text PDFs. Supported formats: -
4602+ Image formats: .bmp, .gif, .heic, .jpeg, .jpg, .png, .tif, .tiff, .webp.
4603+ - PDF format: .pdf. Unsupported formats return an
4604+ `unsupported_format_error`. For the `url` variant only Dropbox shared
4605+ links are supported; external URLs return `unsupported_format_error`.
4606+ Text-based PDFs already carry a text layer, so OCR is not run against
4607+ them and the result is empty; use `get_text_async` to read the embedded
4608+ text layer of such a PDF. The result carries the extracted words as
4609+ plain text, plus the same content as hOCR with per-word coordinates.
4610+
4611+ Route attributes:
4612+ scope: files.content.read
4613+
4614+ :param file_id_or_url: Identifier of the file to run OCR on. Callers
4615+ must set exactly one of the `FileIdOrUrl` variants. OCR is supported
4616+ for image files and PDFs, including scanned / non-text PDFs; see the
4617+ route description for the supported formats. Requests against
4618+ unsupported formats return `unsupported_format_error`. NOTE: for the
4619+ `url` variant, only Dropbox shared links (www.dropbox.com) are
4620+ supported. External (non-Dropbox) URLs are not supported and return
4621+ `unsupported_format_error`; import the file into Dropbox and
4622+ reference it by `file_id` or `path` instead.
4623+ :type file_id_or_url: Nullable[:class:`dropbox.riviera.FileIdOrUrl`]
4624+ :rtype: :class:`dropbox.async_.LaunchResultBase`
4625+ """
4626+ arg = riviera .GetOcrArgs (file_id_or_url )
4627+ r = self .request (
4628+ riviera .get_ocr_async ,
4629+ "riviera" ,
4630+ arg ,
4631+ None ,
4632+ )
4633+ return r
4634+
4635+ def riviera_get_ocr_async_check (self , async_job_id ):
4636+ """
4637+ Returns the status or result of specified get_ocr_async task.
4638+
4639+ Route attributes:
4640+ scope: files.content.read
4641+
4642+ :param async_job_id: Id of the asynchronous job. This is the value of a
4643+ response returned from the method that launched the job.
4644+ :type async_job_id: str
4645+ :rtype: :class:`dropbox.riviera.GetOcrAsyncCheckResult`
4646+ :raises: :class:`.exceptions.ApiError`
4647+
4648+ If this raises, ApiError will contain:
4649+ :class:`dropbox.async_.PollError`
4650+ """
4651+ arg = async_ .PollArg (async_job_id )
4652+ r = self .request (
4653+ riviera .get_ocr_async_check ,
4654+ "riviera" ,
4655+ arg ,
4656+ None ,
4657+ )
4658+ return r
4659+
45984660 def riviera_get_text_async (self , file_id_or_url = None ):
45994661 """
46004662 Asynchronous plain-text extraction from documents. Supported formats
0 commit comments