OCR Preprocessing API: Get the Angle of the Page, Document or Receipt for an OCR Conversion

Cloudmersive
2 min readMay 20, 2022

It’s very common to take photos for OCR operations now, but those photos are often imperfect. You can easily work around this issue with our Page Angle OCR Preprocessing API, which will quickly analyze and identify the rotation angle of the page in question. With that information, you can adjust the page as needed to ensure the subsequent OCR operation works perfectly as intended.

To help you take advantage of this API with JavaScript, we’ve included ready-to-run code with instructions to structure your API call below.

Let’s kick things off by installing the jQuery library. You can do that by running the below command:

bower install jquery

Once that’s done, include the below snippet to capture the input file for the preprocessing operation:

var form = new FormData();
form.append("imageFile", fileInput.files[0], "file");

Last but not least, let’s structure the API call:

var settings = {
"url": "https://api.cloudmersive.com/ocr/preprocessing/image/get-page-angle",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});

Once you include your Cloudmersive API key, you’re all set — easy as pie. To get a key, simply register a free account on our website (Home — Cloudmersive APIs). With that account, you’ll receive a limit of 800 API calls per month.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.