The Node.js Document Rectification SDK is a Node binding to Dynamsoft Label Recognizer C++ SDK. It helps developers build Node.js applications for document rectification on Windows and Linux.
Get a 30-day FREE trial license to activate the SDK.
-
Platform-specific C/C++ compiler
-
node-gyp
npm i node-gyp -g
- Windows
- Linux
Set the LICENSE-KEY
and specify the image-file
in the code below:
const DocRectifier = require('docrectifier4nodejs');
DocRectifier.initLicense('LICENSE-KEY');
var obj = new DocRectifier();
(async function () {
try {
obj.setParameters(DocRectifier.Template.color);
let results = await obj.detectFileAsync('image-file');
let result = results[0];
result = await obj.normalizeFileAsync('image-file', result['x1'], result['y1'], result['x2'], result['y2'], result['x3'], result['y3'], result['x4'], result['y4']);
obj.save('test.png');
} catch (error) {
console.log(error);
}
})();
initLicense(licenseKey)
setParameters(template)
getParameters()
detectFileAsync(imageFile, callback)
detectBufferAsync(imageBuffer, width, height, stride, callback)
normalizeFileAsync(imageFile, x1, y1, x2, y2, x3, y3, x4, y4, callback)
normalizeBufferAsync(imageBuffer, width, height, stride, x1, y1, x2, y2, x3, y3, x4, y4, callback)
save(imageFile)