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)
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}); Copy
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});
Constructs a new OCRJob instance.
OCRJob
The parameters for constructing an instance of OCRJob.
The input asset for the job. Cannot be undefined.
Optional
Asset object representing the output asset.
OCRParams object to specify the OCR parameters.
External assets can be set as output only when input is external asset as well.
Private
Readonly
Protected
Generated using TypeDoc
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: