20 lines
679 B
TypeScript
20 lines
679 B
TypeScript
import { expect, tap } from '@pushrocks/tapbundle';
|
|
import * as smartocr from '../ts/index';
|
|
|
|
let testOcrInstance: smartocr.SmartOcr;
|
|
|
|
tap.test('should create a valid instance of Smartocr', async () => {
|
|
testOcrInstance = await smartocr.SmartOcr.createAndInit();
|
|
expect(testOcrInstance).to.be.instanceOf(smartocr.SmartOcr);
|
|
});
|
|
|
|
tap.test('should ocr a pdfBuffer', async () => {
|
|
const smartfile = await import('@pushrocks/smartfile');
|
|
const pdfBuffer = (await smartfile.Smartfile.fromFilePath('./test/demo_without_textlayer.pdf'))
|
|
.contentBuffer;
|
|
const resultBuffer = await testOcrInstance.processPdfBuffer(pdfBuffer);
|
|
console.log(resultBuffer);
|
|
});
|
|
|
|
tap.start();
|