Show / Hide Table of Contents

Class OCRJob

A job that convert a PDF file into a searchable PDF file. Allows specifying locale( OCRSupportedLocale) and OCR Type (OCRSupportedType) for performing OCR (Optical Character Recognition)

Inheritance
System.Object
PDFServicesJob
OCRJob
Namespace: Adobe.PDFServicesSDK.pdfjobs.jobs
Assembly: Adobe.PDFServicesSDK.Doc.dll
Syntax
public class OCRJob : PDFServicesJob
Examples

Sample Usage:

    using Stream inputStream = File.OpenRead("<SOURCE_PATH>");

    ICredentials credentials = new ServicePrincipalCredentials(
        Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_ID"),
        Environment.GetEnvironmentVariable("PDF_SERVICES_CLIENT_SECRET"));

    PDFServices pdfServices = new PDFServices(credentials);

    IAsset asset = pdfServices.Upload(inputStream, PDFServicesMediaType.PDF.GetMIMETypeValue());

    OCRJob ocrJob = new OCRJob(asset);
    String location = pdfServices.Submit(ocrJob);
    PDFServicesResponse<OCRResult> pdfServicesResponse =
        pdfServices.GetJobResult<OCRResult>(location, typeof(OCRResult));

    IAsset resultAsset = pdfServicesResponse.Result.Asset;
    StreamAsset streamAsset = pdfServices.GetContent(resultAsset);

Constructors

OCRJob(IAsset)

Constructs a new AutotagPDFJob instance with input asset.

Declaration
public OCRJob(IAsset asset)
Parameters
Type Name Description
IAsset asset

The input asset for the job; can not be null.

Methods

SetOutput(IAsset)

Sets the output asset for the job.

Declaration
public OCRJob SetOutput(IAsset asset)
Parameters
Type Name Description
IAsset asset

IAsset object representing the output asset; can not be null.

Returns
Type Description
OCRJob

OCRJob instance

Remarks

External assets can be set as output only when input is external asset as well

SetParams(OCRParams)

Sets the parameters for the job.

Declaration
public OCRJob SetParams(OCRParams ocrParams)
Parameters
Type Name Description
OCRParams ocrParams

OCRParams for the job.

Returns
Type Description
OCRJob

OCRJob instance

In This Article
  • Constructors
    • OCRJob(IAsset)
  • Methods
    • SetOutput(IAsset)
    • SetParams(OCRParams)
Back to top Copyright © 2020 Adobe. All rights reserved.