The context object.
The file to be analyzed. Must be a PDF or an image file.
Options for the OCR process, including endpoint, key, and model.
The extracted data from the document.
const files = await showUploadFile(ctx, {
fileUploadTitle: 'Upload Files',
uploadButton: 'Upload',
fileUploadText: 'Please select file to upload.',
minFileLimit: 1,
maxFileLimit: 1,
text: 'Please upload a file',
});
if (!files) {
throw new Error('No files uploaded');
}
const options = {
endpoint: 'https://{YOUR_ENDPOINT}.cognitiveservices.azure.com/',
key: 'YOUR_KEY',
};
const data = await ocrDocument(ctx, file, options);
console.log(data);
Analyzes a document using OCR (Optical Character Recognition) and returns the extracted data.