OcrDocumentSaver class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Properties
Whether face extraction is supported on the current platform.
no setter
Static Methods
burnWatermark (Uint8List imageBytes , OcrWatermark watermark , {int quality = 90 })
→ Future <Uint8List >
Burns watermark into image bytes using native platform rendering.
compressImage (Uint8List imageBytes , {int quality = 80 })
→ Future <Uint8List >
Compresses image bytes using native JPEG compression.
Accepts any input format (JPEG, PNG, WEBP, BMP, HEIC, etc.)
quality — 1 (smallest) to 100 (best). Default 80.
correctOrientation (Uint8List imageBytes )
→ Future <Uint8List >
Corrects image orientation based on EXIF data.
Returns the image bytes with correct upright orientation.
On Windows/Linux, returns the original bytes unchanged.
For PDF-rendered images, orientation correction is skipped
since PDFs are already correctly oriented.
download ({required OcrResult result , required Uint8List originalImageBytes , String ? fileName , OcrWatermark ? watermark , int imageQuality = 90 , OcrImageFormat format = OcrImageFormat.jpeg })
→ Future <File >
Downloads to the platform's download folder.
downloadBytes ({required Uint8List imageBytes , String ? fileName , OcrWatermark ? watermark , int imageQuality = 90 , OcrImageFormat format = OcrImageFormat.jpeg })
→ Future <File >
Saves raw bytes to the platform's download folder.
downloadFromPath ({required OcrResult result , required String originalImagePath , String ? fileName , OcrWatermark ? watermark , int imageQuality = 90 , OcrImageFormat ? format })
→ Future <File >
Downloads from a file path. Auto-detects format from file extension.
enhanceForOcr (Uint8List imageBytes )
→ Future <Uint8List >
Enhances a low-quality image for better OCR accuracy.
Extracts the face/photo from a document image (Aadhaar, PAN, etc.)
Uses native face detection (ML Kit on Android, Vision on iOS/macOS).
Returns cropped face image bytes, or null if no face found.
Extracts face from a file path.
Returns null if no face found or platform not supported.
getPdfPageCount (Uint8List pdfBytes )
→ Future <int >
Returns the number of pages in a PDF.
Returns 0 if the PDF cannot be read.
renderAllPdfPages (Uint8List pdfBytes , {double scale = 2.0 })
→ Future <List <Uint8List > >
Renders all pages of a PDF to image bytes list.
Returns a list of JPEG image bytes for each page.
renderPdfPage (Uint8List pdfBytes , {int page = 0 , double scale = 2.0 })
→ Future <Uint8List ? >
Renders a single PDF page to image bytes (JPEG).
pdfBytes — raw PDF file bytes.
page — zero-based page index (default 0).
scale — render scale factor (default 2.0 for high quality).
Returns image bytes or null if rendering fails.
Uses native PDF rendering — no third-party packages needed.
save ({required OcrResult result , required Uint8List originalImageBytes , required Directory directory , String ? fileName , OcrWatermark ? watermark , int imageQuality = 90 , OcrImageFormat format = OcrImageFormat.jpeg })
→ Future <File >
Saves to a specific directory.
saveFromPath ({required OcrResult result , required String originalImagePath , required Directory directory , String ? fileName , OcrWatermark ? watermark , int imageQuality = 90 , OcrImageFormat ? format })
→ Future <File >
Saves from a file path to a specific directory.