# detectDocument static method

Future<Page> detectDocument(

1. Page page

)

Performs auto document detection on the ORIGINAL image of the given `page` and creates (cropped) DOCUMENT image. The given `page` must have the ORIGINAL image. return `Page` with detected polygon.

## Implementation

    static Future<Page> detectDocument(Page page) async {
      try {
        var arguments = {'page': page.toJson()};
        var documentScanningResult =
            await _channel.invokeMethod('detectDocument', arguments);
        var json = jsonDecode(documentScanningResult);
        var pageResult = Page.fromJson(json);
        return pageResult;
      } catch (e) {
        return page;
      }
    }