Rotates page so that a matched anchor becomes horizontal.

In most cases, Sensible corrects page rotation automatically. If it doesn’t, configure this preprocessor. For example, if a scanned ID card is vertically oriented, and the scanner adds automatically generated horizontal text, you can use this preprocessor to correct the mix of text orientations. Configure the preprocessor to match the text that you want to see horizontally aligned.

Parameters

keyvaluedescription
type (required)rotatePage
matchMatch object or array of Match objectsSensible rotates the page to ensure that text that matches this parameter is horizontal. Sensible rotates the page by multiples of 90 degrees. If the page is affected by translation, shear, or other affine transformations, or if the page rotation isn’t a multiple of 90 degrees, use the Deskew preprocessor.
matchAllbooleanIf true, rotates all pages containing the line specified by the Match parameter.

Examples

The following image shows that without the Rotate page preprocessor, extraction from a rotated document fails. The Region method returns null, because the targeted text isn’t in the expected region:

To solve this problem, configure a match for text that you want to be horizontal, and Sensible rotates the page:

Config

JSON
{
  "preprocessors": [
    {
      "type": "rotatePage",
      "match": "first dog ID card"
    }
  ],
  "fields": [
    {
      "id": "tenure",
      "anchor": {
        "match": {
          "type": "endsWith",
          "text": "tenure:"
        }
      },
      "method": {
        "id": "region",
        "start": "below",
        "width": 1.6,
        "height": 0.5,
        "offsetX": -1,
        "offsetY": 0
      }
    }
  ]
}

Example document

The following images show the example document used with this example config:

Example documentDownload link

Output

JSON
{
  "tenure": {
    "type": "string",
    "value": "1961 -1963"
  }
}
`