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)

Example

Sample Usage:

        const readStream = fs.createReadStream("<SOURCE_PATH>");

const credentials = new ServicePrincipalCredentials({
clientId: process.env.PDF_SERVICES_CLIENT_ID,
clientSecret: process.env.PDF_SERVICES_CLIENT_SECRET
});

const pdfServices = new PDFServices({credentials});

const inputAsset = await pdfServices.upload({
readStream,
mimeType: MimeType.PDF
});

const job = new OCRJob({inputAsset});

const pollingURL = await pdfServices.submit({job});

const pdfServicesResponse = await pdfServices.getJobResult({
pollingURL,
resultType: OCRResult
});

const resultAsset = pdfServicesResponse.result.asset;
const streamAsset = await pdfServices.getContent({asset: resultAsset});

Hierarchy (view full)

Constructors

  • Constructs a new OCRJob instance.

    Parameters

    • params: {
          inputAsset: Asset;
          outputAsset?: Asset;
          params?: OCRParams;
      }

      The parameters for constructing an instance of OCRJob.

      • inputAsset: Asset

        The input asset for the job. Cannot be undefined.

      • Optional outputAsset?: Asset

        Asset object representing the output asset.

      • Optional params?: OCRParams

        OCRParams object to specify the OCR parameters.

    Returns OCRJob

    Remarks

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

Properties

_inputAsset: Asset
_ocrParams?: OCRParams
_outputAsset?: Asset

Methods

  • Parameters

    Returns PDFServicesApiRequest

  • Parameters

    • executionContext: ExecutionContext

    Returns void

Generated using TypeDoc