Skip to content

App crashes if we feed pdf in ocr #40

@momin-mostafa

Description

@momin-mostafa

scenario :
use google_mlkit_text_recognition version. pick a pdf file from user. And feed it through OCR. App Crashes. Need a file type validation to ensure only image files are being passed to filePathToVisionImage method here.

code that causes crash :

22 + (MLKVisionImage *)filePathToVisionImage:(NSString *)filePath {
23     UIImage *image = [UIImage imageWithContentsOfFile:filePath];
24     MLKVisionImage *visionImage = [[MLKVisionImage alloc] initWithImage:image];  // gives error in this line
25     visionImage.orientation = image.imageOrientation;
26     return visionImage;
27 }

config:

google_mlkit_text_recognition: ^0.15.0
flutter - sdk: '>=3.3.0 <4.0.0'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions