public static string ScanImage() { string pathfile = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); Directory.CreateDirectory(pathfile + @"\Mostootriad\scan"); string ScanPath = pathfile + @"\Mostootriad\scan\${TMS}${EXT}"; try { Result result = new AspriseImaging().Scan(new Request().AddOutputItem( new RequestOutputItem(AspriseImaging.OUTPUT_SAVE, AspriseImaging.FORMAT_PDF) .SetPdfTextLine("Scanned on ${DATETIME} by user X") // Optional text line at the bottom of the 1st page .AddExifTag("DocumentName", "Scan to PDF by Asprise") // Optional PDF doc properties (metadata) .SetSavePath(ScanPath)) .SetPromptScanMore(true) , "select", true, true); string pdfFile = result == null ? null : result.GetPdfFile(); ScanPath = pdfFile; } catch (Exception ex) { MessageBox.Show("Не удалось запустить сканирование: " + ex.Message + ". Проверьте наличие драйвера для сканера. Подключено ли сканирующее устройство к компьютеру.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(ScanPath); }
public Scan() { Result result = new AspriseImaging().Scan(new Request().AddOutputItem(new RequestOutputItem(AspriseImaging.OUTPUT_RETURN_BASE64, AspriseImaging.FORMAT_JPG)) // Output type and image format , "default", true, true); // "select" a scanner or use "default" scanner without selection this.img = result.GetImage(0); }