# createPage static method

Future<Page> createPage(

1. Uri originalImageFileUri,
2. bool shouldDetectDocument, {
3. Size? originalImageSizeLimit,
4. Size? documentImageSizeLimit,

})

Creates a new Page from an image file located at `originalImageFileUri`.

If `shouldDetectDocument` is `true`, performs automatic document detection. `originalImageSizeLimit` and `documentImageSizeLimit` control downscaling for large images.

## Implementation

    static Future<Page> createPage(
        Uri originalImageFileUri, bool shouldDetectDocument,
        {Size? originalImageSizeLimit, Size? documentImageSizeLimit}) async {
      try {
        var arguments = {
          'originalImageFileUri': originalImageFileUri.toString(),
          'shouldDetectDocument': shouldDetectDocument
        };
        originalImageSizeLimit
            ?.let((self) => arguments["originalImageSizeLimit"] = self.toJson());
        documentImageSizeLimit
            ?.let((self) => arguments["documentImageSizeLimit"] = self.toJson());
        final pageJson = await channel.invokeMethod('createPage', arguments);
        var decoded = jsonDecode(pageJson);
        return Page.fromJson(decoded);
      } catch (e) {
        Logger.root.severe(e);
        rethrow;
      }
    }