# createPage static method

Future<Page> createPage(

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

})

Creates a `page` from an image file URI. The given image will be used as the ORIGINAL image. Use the `shouldDetectDocument` flag to specify whether the auto-document detection should be performed and the (cropped) DOCUMENT image should be created.

`originalImageSizeLimit` the maximum size of the original image to be saved. If the original image is larger than the specified size it will be downscaled. By default, not specified.

`documentImageSizeLimit` the maximum size of the cropped document image to be saved. If the image is larger than the specified size it will be downscaled. If `originalImageSizeLimit` is set it also limits the size of the cropped document image. By default, not specified.

Returns Page

## 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;
      }
    }