download method

dynamic download(
  1. int type,
  2. String filename
)

Download images.

Implementation

download(int type, String filename) {
  if (_webTwain != null && _webTwain!.HowManyImagesInBuffer > 0) {
    _webTwain!.IfShowFileDialog = true;
    switch (type) {
      case 0:
        _webTwain!.SaveAllAsPDF(
            filename, allowInterop(() => {}), allowInterop(() => {}));
        break;
      case 1:
        _webTwain!.SaveAllAsMultiPageTIFF(
            filename, allowInterop(() => {}), allowInterop(() => {}));
        break;
      case 2:
        if (_webTwain!
                .GetImageBitDepth(_webTwain!.CurrentImageIndexInBuffer) ==
            1) {
          _webTwain!.ConvertToGrayScale(_webTwain!.CurrentImageIndexInBuffer);
        }
        _webTwain!.SaveAsJPEG(filename, _webTwain!.CurrentImageIndexInBuffer);
    }
  }
}